From 7ac6f537437259dde30d214a9396c9bb340ccce2 Mon Sep 17 00:00:00 2001 From: Steven Joruk Date: Wed, 8 Dec 2021 21:49:22 +0000 Subject: [PATCH] Code review fixes --- src/doc/man/includes/options-display.md | 2 ++ src/doc/src/reference/config.md | 1 + .../src/reference/environment-variables.md | 1 + tests/testsuite/run.rs | 28 +++++++++++-------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/doc/man/includes/options-display.md b/src/doc/man/includes/options-display.md index 051edcae3..917dac49c 100644 --- a/src/doc/man/includes/options-display.md +++ b/src/doc/man/includes/options-display.md @@ -7,6 +7,8 @@ May also be specified with the `term.verbose` {{#option "`-q`" "`--quiet`"}} Do not print cargo log messages. +May also be specified with the `term.quiet` +[config value](../reference/config.html). {{/option}} {{#option "`--color` _when_"}} diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md index ec0ef3483..abba63a06 100644 --- a/src/doc/src/reference/config.md +++ b/src/doc/src/reference/config.md @@ -168,6 +168,7 @@ metadata_key1 = "value" metadata_key2 = "value" [term] +quiet = false # whether cargo output is quiet verbose = false # whether cargo provides verbose output color = 'auto' # whether cargo colorizes output progress.when = 'auto' # whether cargo shows progress bar diff --git a/src/doc/src/reference/environment-variables.md b/src/doc/src/reference/environment-variables.md index 88f3c94e4..9034f15d6 100644 --- a/src/doc/src/reference/environment-variables.md +++ b/src/doc/src/reference/environment-variables.md @@ -114,6 +114,7 @@ supported environment variables are: * `CARGO_TARGET__LINKER` — The linker to use, see [`target..linker`]. The triple must be [converted to uppercase and underscores](config.md#environment-variables). * `CARGO_TARGET__RUNNER` — The executable runner, see [`target..runner`]. * `CARGO_TARGET__RUSTFLAGS` — Extra `rustc` flags for a target, see [`target..rustflags`]. +* `CARGO_TERM_QUIET` — Quiet mode, see [`term.quiet`]. * `CARGO_TERM_VERBOSE` — The default terminal verbosity, see [`term.verbose`]. * `CARGO_TERM_COLOR` — The default color mode, see [`term.color`]. * `CARGO_TERM_PROGRESS_WHEN` — The default progress bar showing mode, see [`term.progress.when`]. diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 8f2db8e66..0ff0de684 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -27,12 +27,11 @@ fn quiet_arg() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - p.cargo("build -q") - .with_stderr_does_not_contain("[FINISHED] [..]") - .run(); + p.cargo("run -q").with_stderr("").with_stdout("hello").run(); - p.cargo("build --quiet") - .with_stderr_does_not_contain("[FINISHED] [..]") + p.cargo("run --quiet") + .with_stderr("") + .with_stdout("hello") .run(); } @@ -42,7 +41,7 @@ fn quiet_arg_and_verbose_arg() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - p.cargo("build -q -v") + p.cargo("run -q -v") .with_status(101) .with_stderr("[ERROR] cannot set both --verbose and --quiet") .run(); @@ -61,9 +60,7 @@ fn quiet_arg_and_verbose_config() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - p.cargo("build -q") - .with_stderr_does_not_contain("[FINISHED] [..]") - .run(); + p.cargo("run -q").with_stderr("").with_stdout("hello").run(); } #[cargo_test] @@ -79,8 +76,15 @@ fn verbose_arg_and_quiet_config() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - p.cargo("build -v") - .with_stderr_contains("[RUNNING] `rustc [..]") + p.cargo("run -v") + .with_stderr( + "\ +[COMPILING] foo v0.0.1 ([CWD]) +[RUNNING] `rustc [..] +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] +[RUNNING] `target/debug/foo[EXE]`", + ) + .with_stdout("hello") .run(); } @@ -98,7 +102,7 @@ fn quiet_config_and_verbose_config() { .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build(); - p.cargo("build") + p.cargo("run") .with_status(101) .with_stderr("[ERROR] cannot set both `term.verbose` and `term.quiet`") .run();