don't assert the same thing twice

This commit is contained in:
Ralf Jung 2022-06-25 20:01:36 -04:00
parent da6a78012a
commit fed0e16397

View File

@ -952,15 +952,14 @@ fn phase_runner(binary: &Path, binary_args: env::Args, phase: RunnerPhase) {
assert!(suffix.starts_with('='));
// Drop this argument.
} else if let Some(suffix) = arg.strip_prefix(json_flag) {
assert!(suffix.starts_with('='));
let suffix = suffix.strip_prefix('=').unwrap();
// This is how we pass through --color=always. We detect that Cargo is detecting rustc
// to emit the diagnostic structure that Cargo would consume from rustc to emit colored
// diagnostics, and ask rustc to emit them.
// See https://github.com/rust-lang/miri/issues/2037
// First skip over the leading `=`, then check for diagnostic-rendered-ansi in the
// comma-separated list
if suffix.strip_prefix('=').unwrap().split(',').any(|a| a == "diagnostic-rendered-ansi")
{
if suffix.split(',').any(|a| a == "diagnostic-rendered-ansi") {
cmd.arg("--color=always");
}
// But aside from remembering that colored output was requested, drop this argument.