diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-29 20:12:43 +1100 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-29 20:12:43 +1100 | 
| commit | 607bf653c2bed1ec3f7979d9511f3c9cef604bc3 (patch) | |
| tree | d20810961569b3d831c2a3dd8ece7afe8c63760d /compiler/rustc_errors/src/json.rs | |
| parent | 58f45059a5e39135ac5e26a662821dc13c0e4e56 (diff) | |
| download | rust-607bf653c2bed1ec3f7979d9511f3c9cef604bc3.tar.gz rust-607bf653c2bed1ec3f7979d9511f3c9cef604bc3.zip | |
Avoid unnecessary `color` local variable.
Diffstat (limited to 'compiler/rustc_errors/src/json.rs')
| -rw-r--r-- | compiler/rustc_errors/src/json.rs | 9 | 
1 files changed, 3 insertions, 6 deletions
| 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) | 
