From 0f42069f8f21952dc00c46fe8dd4883feeec20b8 Mon Sep 17 00:00:00 2001 From: nozwock <57829219+nozwock@users.noreply.github.com> Date: Fri, 7 Nov 2025 02:26:07 +0530 Subject: [PATCH 1/2] feat(rustup-mode): add `no_update` flag to `rustup toolchain install` --- src/cli/rustup_mode.rs | 14 +++++-- ..._cmd_install_cmd_help_flag.stdout.term.svg | 38 ++++++++++--------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 48e865eb78..6979b8f4a7 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, @@ -971,9 +975,13 @@ async fn update( let status = match DistributableToolchain::new(cfg, desc.clone()) { Ok(d) => { - InstallMethod::Dist(dist_opts.for_update(&d, opts.allow_downgrade)) - .install() - .await? + if !opts.no_update { + InstallMethod::Dist(dist_opts.for_update(&d, opts.allow_downgrade)) + .install() + .await? + } else { + UpdateStatus::Unchanged + } } Err(RustupError::ToolchainNotInstalled { .. }) => { DistributableToolchain::install(dist_opts).await?.0 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 @@ - +