doctests run via cargo test are not silenced with --quiet #9728
Labels
A-console-output
Area: Terminal output, colors, progress bar, etc.
A-doctests
Area: rustdoc --test
C-bug
Category: bug
E-easy
Experience: Easy
Problem
When passing
--quiet
tocargo test
, doctests are still printed in a verbose style, a though--quiet
had not been forwarded to them (output cut for brevity)This can also be seen by running
cargo test -- --quiet
, which manually passes--quiet
to each doctest.Steps
cargo test --quiet
cargo test -- --quiet
Possible Solution(s)
After looking in src/cargo/ops/cargo_test.rs, I noticed that
run_unit_tests
will add--quiet
to each target ifharness=true
and the verbosity is set to quiet.However, this same operation does not happen in
run_doc_tests
. Having had a brief look at the source it seems the sameunit.target.harness()
andconsole.shell().verbosity()
could be done after thetest_args
are pushed into the commandThis would explain why
--quiet
does not work, but-- --quiet
does.Notes
Output of
cargo version
: cargo 1.53.0 (4369396 2021-04-27)OS: Windows 10
Although I linked above to recent commits, this code has remained untouched since March of 2021.
The text was updated successfully, but these errors were encountered: