Skip to content

Commit 189885a

Browse files
committed
cli: inline single-use update_all_channels() helper
1 parent 348102e commit 189885a

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

src/cli/common.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,20 @@ pub(crate) async fn update_all_channels(
215215
cfg: &Cfg<'_>,
216216
force_update: bool,
217217
) -> Result<utils::ExitCode> {
218-
let toolchains = cfg.update_all_channels(force_update).await?;
218+
let profile = cfg.get_profile()?;
219+
let mut toolchains = Vec::new();
220+
for (desc, mut distributable) in cfg.list_channels()? {
221+
let result = distributable
222+
.update_extra(&[], &[], profile, force_update, false)
223+
.await;
224+
225+
if let Err(e) = &result {
226+
error!("{e}");
227+
}
228+
229+
toolchains.push((desc, result));
230+
}
231+
219232
let has_update_error = toolchains.iter().any(|(_, r)| r.is_err());
220233
let exit_code = utils::ExitCode(if has_update_error { 1 } else { 0 });
221234

src/config.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -892,29 +892,6 @@ impl<'a> Cfg<'a> {
892892
})
893893
}
894894

895-
pub(crate) async fn update_all_channels(
896-
&self,
897-
force_update: bool,
898-
) -> Result<Vec<(ToolchainDesc, Result<UpdateStatus>)>> {
899-
let profile = self.get_profile()?;
900-
901-
// Update toolchains and collect the results
902-
let mut channels = Vec::new();
903-
for (desc, mut distributable) in self.list_channels()? {
904-
let result = distributable
905-
.update_extra(&[], &[], profile, force_update, false)
906-
.await;
907-
908-
if let Err(e) = &result {
909-
error!("{e}");
910-
}
911-
912-
channels.push((desc, result));
913-
}
914-
915-
Ok(channels)
916-
}
917-
918895
pub(crate) fn set_default_host_triple(&self, host_triple: String) -> Result<()> {
919896
// Ensure that the provided host_triple is capable of resolving
920897
// against the 'stable' toolchain. This provides early errors

0 commit comments

Comments
 (0)