Skip to content

Commit 6c77ba6

Browse files
committed
refactor(check): Consolidate use_colors checks
1 parent 68c31aa commit 6c77ba6

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -819,20 +819,18 @@ 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+
(
826+
Style::new(),
827+
Style::new(),
828+
Style::new(),
829+
Style::new(),
830+
Style::new(),
831+
)
826832
};
827833

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-
836834
// Ensure that `.buffered()` is never called with 0 as this will cause a hang.
837835
// See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774
838836
if channels_len > 0 {

0 commit comments

Comments
 (0)