Skip to content

Commit d1fd9fe

Browse files
committed
Auto merge of #10436 - cuviper:rust-1.60.0-config-verbosity, r=alexcrichton
[1.60] Fix term.verbose without quiet, and vice versa Backport of #10429 to fix a regression in 1.59.
2 parents 1e5cac7 + 6034981 commit d1fd9fe

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

src/cargo/util/config/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ impl Config {
919919
(Some(true), Some(true)) => {
920920
bail!("cannot set both `term.verbose` and `term.quiet`")
921921
}
922-
(Some(true), Some(false)) => Verbosity::Verbose,
923-
(Some(false), Some(true)) => Verbosity::Quiet,
922+
(Some(true), _) => Verbosity::Verbose,
923+
(_, Some(true)) => Verbosity::Quiet,
924924
_ => Verbosity::Normal,
925925
},
926926
};

tests/testsuite/run.rs

+41
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,47 @@ fn verbose_arg_and_quiet_config() {
8888
.run();
8989
}
9090

91+
#[cargo_test]
92+
fn quiet_config_alone() {
93+
let p = project()
94+
.file(
95+
".cargo/config",
96+
r#"
97+
[term]
98+
quiet = true
99+
"#,
100+
)
101+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
102+
.build();
103+
104+
p.cargo("run").with_stderr("").with_stdout("hello").run();
105+
}
106+
107+
#[cargo_test]
108+
fn verbose_config_alone() {
109+
let p = project()
110+
.file(
111+
".cargo/config",
112+
r#"
113+
[term]
114+
verbose = true
115+
"#,
116+
)
117+
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
118+
.build();
119+
120+
p.cargo("run")
121+
.with_stderr(
122+
"\
123+
[COMPILING] foo v0.0.1 ([CWD])
124+
[RUNNING] `rustc [..]
125+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
126+
[RUNNING] `target/debug/foo[EXE]`",
127+
)
128+
.with_stdout("hello")
129+
.run();
130+
}
131+
91132
#[cargo_test]
92133
fn quiet_config_and_verbose_config() {
93134
let p = project()

0 commit comments

Comments
 (0)