Skip to content

Commit 607bf65

Browse files
committed
Avoid unnecessary color local variable.
1 parent 58f4505 commit 607bf65

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

compiler/rustc_errors/src/json.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,9 @@ impl Diagnostic {
347347
let buf = BufWriter::default();
348348
let mut dst: Destination = Box::new(buf.clone());
349349
let (short, color_config) = je.json_rendered.unzip();
350-
let color = match color_config {
351-
ColorConfig::Always | ColorConfig::Auto => true,
352-
ColorConfig::Never => false,
353-
};
354-
if color {
355-
dst = Box::new(termcolor::Ansi::new(dst));
350+
match color_config {
351+
ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
352+
ColorConfig::Never => {}
356353
}
357354
HumanEmitter::new(dst, je.fallback_bundle.clone())
358355
.short_message(short)

0 commit comments

Comments
 (0)