Skip to content

Commit

Permalink
Avoid unnecessary color local variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Feb 29, 2024
1 parent 58f4505 commit 607bf65
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions compiler/rustc_errors/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 607bf65

Please sign in to comment.