Skip to content

Commit

Permalink
Auto merge of #10436 - cuviper:rust-1.60.0-config-verbosity, r=alexcr…
Browse files Browse the repository at this point in the history
…ichton

[1.60] Fix term.verbose without quiet, and vice versa

Backport of #10429 to fix a regression in 1.59.
  • Loading branch information
bors committed Mar 1, 2022
2 parents 1e5cac7 + 6034981 commit d1fd9fe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ impl Config {
(Some(true), Some(true)) => {
bail!("cannot set both `term.verbose` and `term.quiet`")
}
(Some(true), Some(false)) => Verbosity::Verbose,
(Some(false), Some(true)) => Verbosity::Quiet,
(Some(true), _) => Verbosity::Verbose,
(_, Some(true)) => Verbosity::Quiet,
_ => Verbosity::Normal,
},
};
Expand Down
41 changes: 41 additions & 0 deletions tests/testsuite/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,47 @@ fn verbose_arg_and_quiet_config() {
.run();
}

#[cargo_test]
fn quiet_config_alone() {
let p = project()
.file(
".cargo/config",
r#"
[term]
quiet = true
"#,
)
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();

p.cargo("run").with_stderr("").with_stdout("hello").run();
}

#[cargo_test]
fn verbose_config_alone() {
let p = project()
.file(
".cargo/config",
r#"
[term]
verbose = true
"#,
)
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();

p.cargo("run")
.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();
}

#[cargo_test]
fn quiet_config_and_verbose_config() {
let p = project()
Expand Down

0 comments on commit d1fd9fe

Please sign in to comment.