From 4b1e3fea7c52defe21350e68174789052a0aceb7 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 29 Oct 2026 17:14:31 +0100 Subject: [PATCH 1/2] refactor(config): rename `Cfg::list_channels()` to `Cfg::list_tracking_channels()` --- src/cli/common.rs | 2 +- src/cli/rustup_mode.rs | 2 +- src/config.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index a7eb5ff1e0..19cd8be114 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -233,7 +233,7 @@ pub(crate) async fn update_all_channels( check: bool, ) -> anyhow::Result { let profile = cfg.get_profile()?; - let channels = cfg.list_channels()?; + let channels = cfg.list_tracking_channels()?; // Run a pre-check to determine which channels have updates available. let channels_with_manifests = join_all(channels.into_iter().map(|(desc, d)| async move { diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index a4d8e49d50..5d38c9967f 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -951,7 +951,7 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> anyhow::Result Cfg<'a> { Ok(toolchains) } - pub(crate) fn list_channels( + pub(crate) fn list_tracking_channels( &self, ) -> anyhow::Result)>> { let mut channels = self From d8567e9b0b851a9a4ce959f9f8436f10a405b54e Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 29 Oct 2026 17:24:24 +0100 Subject: [PATCH 2/2] refactor(config): stop returning `ChannelToolchainName` from `Cfg::list_tracking_channels()` --- src/cli/common.rs | 11 ++++++----- src/cli/rustup_mode.rs | 4 ++-- src/config.rs | 8 +++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index 19cd8be114..b7c086b6d0 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -236,20 +236,21 @@ pub(crate) async fn update_all_channels( let channels = cfg.list_tracking_channels()?; // Run a pre-check to determine which channels have updates available. - let channels_with_manifests = join_all(channels.into_iter().map(|(desc, d)| async move { + let channels_with_manifests = join_all(channels.into_iter().map(|d| async move { // Prefetch errors are intentionally discarded; a failed prefetch falls // back to the normal update path, where errors are properly propagated. let manifest = d.fetch_dist_manifest().await.unwrap_or(None); - (desc, d, manifest) + (d, manifest) })) .await; let mut toolchains = Vec::with_capacity(channels_with_manifests.len()); let mut has_update_error = false; let mut has_update = false; - for (desc, distributable, manifest) in channels_with_manifests { + for (distributable, manifest) in channels_with_manifests { + let desc = distributable.desc(); let result = if force_update || manifest.is_some() { - let options = DistOptions::new(&[], &[], &desc, profile, force_update, cfg)? + let options = DistOptions::new(&[], &[], desc, profile, force_update, cfg)? .for_update(&distributable, false); InstallMethod::Dist(options).install(manifest).await } else { @@ -265,7 +266,7 @@ pub(crate) async fn update_all_channels( _ => (), } - toolchains.push((desc, result)); + toolchains.push((desc.clone(), result)); } let exit_code = if has_update_error { diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 5d38c9967f..080e888631 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -975,8 +975,8 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> anyhow::Result Cfg<'a> { Ok(toolchains) } - pub(crate) fn list_tracking_channels( - &self, - ) -> anyhow::Result)>> { + pub(crate) fn list_tracking_channels(&self) -> anyhow::Result>> { let mut channels = self .list_toolchains(true)? .into_iter() .filter_map(|t| match t { ToolchainName::Channel(n) if n.is_tracking() => { - Some(ChannelToolchain::new(self, n.clone()).map(|t| (n, t))) + Some(ChannelToolchain::new(self, n)) } _ => None, }) @@ -1049,7 +1047,7 @@ impl<'a> Cfg<'a> { // HACK: `.sort_by_key()` is impossible here without cloning. // See: - channels.sort_by(|(n, _), (m, _)| n.cmp(m)); + channels.sort_by(|n, m| n.desc().cmp(m.desc())); Ok(channels) }