Skip to content

Commit 657d68b

Browse files
committed
refactor(cli/self-update): extract has_progress_bars in check_updates()
1 parent 9e34f55 commit 657d68b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cli/rustup_mode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,8 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<ExitCode> {
892892
// If we are running in a TTY, we can use `buffer_unordered` since
893893
// displaying the output in the correct order is already handled by
894894
// `indicatif`.
895-
let channels = if !multi_progress_bars.is_hidden() {
895+
let has_progress_bars = !multi_progress_bars.is_hidden();
896+
let channels = if has_progress_bars {
896897
channels
897898
.buffer_unordered(channels_len)
898899
.collect::<Vec<_>>()
@@ -910,7 +911,7 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<ExitCode> {
910911
if update_a {
911912
update_available = true;
912913
}
913-
if multi_progress_bars.is_hidden() {
914+
if !has_progress_bars {
914915
writeln!(t.lock(), "{message}")?;
915916
}
916917
}

0 commit comments

Comments
 (0)