Skip to content

Commit d7dc3c4

Browse files
committed
Clarify self update logic in update()
1 parent dd7a555 commit d7dc3c4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/cli/rustup_mode.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -914,25 +914,23 @@ async fn update(
914914
cfg.set_default(Some(&desc.into()))?;
915915
}
916916
}
917-
if self_update {
918-
exit_code &= common::self_update(cfg.process).await?;
919-
}
920917
} else if ensure_active_toolchain {
921918
let (toolchain, reason) = cfg.ensure_active_toolchain(force_non_host, true).await?;
922919
info!("the active toolchain `{toolchain}` has been installed");
923920
info!("it's active because: {reason}");
924921
} else {
925922
exit_code &= common::update_all_channels(cfg, opts.force).await?;
926-
if self_update {
927-
exit_code &= common::self_update(cfg.process).await?;
928-
}
929-
930923
info!("cleaning up downloads & tmp directories");
931924
utils::delete_dir_contents_following_links(&cfg.download_dir);
932925
cfg.tmp_cx.clean();
933926
}
934927

935-
check_rustup_update(self_update_mode, false, cfg).await?;
928+
if self_update && !ensure_active_toolchain {
929+
exit_code &= common::self_update(cfg.process).await?;
930+
} else {
931+
check_rustup_update(self_update_mode, false, cfg).await?;
932+
}
933+
936934
Ok(exit_code)
937935
}
938936

0 commit comments

Comments
 (0)