From 8b207015df616e844f2b20e4891411c1ddbe037b Mon Sep 17 00:00:00 2001 From: nozwock <57829219+nozwock@users.noreply.github.com> Date: Fri, 10 Oct 2025 11:00:57 +0530 Subject: [PATCH 1/2] feat(rustup-mode): add `no_update` flag to `rustup toolchain install` --- src/cli/rustup_mode.rs | 12 +++++- ..._cmd_install_cmd_help_flag.stdout.term.svg | 38 ++++++++++--------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index fd2c4906c9..276dc0f878 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -386,6 +386,10 @@ struct UpdateOpts { #[arg(long)] no_self_update: bool, + /// Don't try to update the installed toolchain + #[arg(long)] + no_update: bool, + /// Force an update, even if some components are missing #[arg(long)] force: bool, @@ -966,8 +970,12 @@ async fn update( let profile = cfg.get_profile()?; let status = match DistributableToolchain::new(cfg, desc.clone()) { Ok(mut d) => { - d.update_extra(&components, &targets, profile, force, allow_downgrade) - .await? + if !opts.no_update { + d.update_extra(&components, &targets, profile, force, allow_downgrade) + .await? + } else { + UpdateStatus::Unchanged + } } Err(RustupError::ToolchainNotInstalled { .. }) => { DistributableToolchain::install( diff --git a/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg b/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg index cf66aa826d..fada49de25 100644 --- a/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg +++ b/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg @@ -1,4 +1,4 @@ - +