Skip to content

Commit 02b1314

Browse files
committed
refactor(check): Consolidate use_colors checks
1 parent b9a8567 commit 02b1314

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -819,20 +819,12 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<ExitCode> {
819819
Some(_) | None => channels_len,
820820
};
821821

822-
let bold = if use_colors {
823-
Style::new().bold()
822+
let (bold, transient, error, good, warn) = if use_colors {
823+
(Style::new().bold(), TRANSIENT, ERROR, GOOD, WARN)
824824
} else {
825-
Style::new()
825+
Default::default()
826826
};
827827

828-
let transient = if use_colors { TRANSIENT } else { Style::new() };
829-
830-
let error = if use_colors { ERROR } else { Style::new() };
831-
832-
let good = if use_colors { GOOD } else { Style::new() };
833-
834-
let warn = if use_colors { WARN } else { Style::new() };
835-
836828
// Ensure that `.buffered()` is never called with 0 as this will cause a hang.
837829
// See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774
838830
if channels_len > 0 {

0 commit comments

Comments
 (0)