diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 77e4f9a0767..bc1822f83fc 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -347,12 +347,9 @@ impl Diagnostic { let buf = BufWriter::default(); let mut dst: Destination = Box::new(buf.clone()); let (short, color_config) = je.json_rendered.unzip(); - let color = match color_config { - ColorConfig::Always | ColorConfig::Auto => true, - ColorConfig::Never => false, - }; - if color { - dst = Box::new(termcolor::Ansi::new(dst)); + match color_config { + ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)), + ColorConfig::Never => {} } HumanEmitter::new(dst, je.fallback_bundle.clone()) .short_message(short)