1
Fork 0

Avoid unnecessary color local variable.

This commit is contained in:
Nicholas Nethercote 2024-02-29 20:12:43 +11:00
parent 58f45059a5
commit 607bf653c2

View file

@ -347,12 +347,9 @@ impl Diagnostic {
let buf = BufWriter::default(); let buf = BufWriter::default();
let mut dst: Destination = Box::new(buf.clone()); let mut dst: Destination = Box::new(buf.clone());
let (short, color_config) = je.json_rendered.unzip(); let (short, color_config) = je.json_rendered.unzip();
let color = match color_config { match color_config {
ColorConfig::Always | ColorConfig::Auto => true, ColorConfig::Always | ColorConfig::Auto => dst = Box::new(termcolor::Ansi::new(dst)),
ColorConfig::Never => false, ColorConfig::Never => {}
};
if color {
dst = Box::new(termcolor::Ansi::new(dst));
} }
HumanEmitter::new(dst, je.fallback_bundle.clone()) HumanEmitter::new(dst, je.fallback_bundle.clone())
.short_message(short) .short_message(short)