Skip to content

Commit 3d51ca4

Browse files
rbtcollinsdjc
authored andcommitted
Make DistributableToolchain::remove_component async
1 parent 3613fec commit 3d51ca4

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/cli/rustup_mode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ fn target_remove(
11851185
warn!("after removing the last target, no build targets will be available");
11861186
}
11871187
let new_component = Component::new("rust-std".to_string(), Some(target), false);
1188-
distributable.remove_component(new_component)?;
1188+
utils::run_future(distributable.remove_component(new_component))?;
11891189
}
11901190

11911191
Ok(utils::ExitCode(0))
@@ -1239,7 +1239,7 @@ fn component_remove(
12391239

12401240
for component in &components {
12411241
let new_component = Component::try_new(component, &distributable, target.as_ref())?;
1242-
distributable.remove_component(new_component)?;
1242+
utils::run_future(distributable.remove_component(new_component))?;
12431243
}
12441244

12451245
Ok(utils::ExitCode(0))

src/toolchain/distributable.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use crate::{
1616
},
1717
install::{InstallMethod, UpdateStatus},
1818
notifications::Notification,
19-
utils::utils,
2019
RustupError,
2120
};
2221

@@ -469,7 +468,7 @@ impl<'a> DistributableToolchain<'a> {
469468
}
470469
}
471470

472-
pub(crate) fn remove_component(&self, mut component: Component) -> anyhow::Result<()> {
471+
pub(crate) async fn remove_component(&self, mut component: Component) -> anyhow::Result<()> {
473472
// TODO: take multiple components?
474473
let manifestation = self.get_manifestation()?;
475474
let config = manifestation.read_config()?.unwrap_or_default();
@@ -518,14 +517,16 @@ impl<'a> DistributableToolchain<'a> {
518517
&|n: crate::dist::Notification<'_>| (self.cfg.notify_handler)(n.into());
519518
let download_cfg = self.cfg.download_cfg(&notify_handler);
520519

521-
utils::run_future(manifestation.update(
522-
&manifest,
523-
changes,
524-
false,
525-
&download_cfg,
526-
&self.desc.manifest_name(),
527-
false,
528-
))?;
520+
manifestation
521+
.update(
522+
&manifest,
523+
changes,
524+
false,
525+
&download_cfg,
526+
&self.desc.manifest_name(),
527+
false,
528+
)
529+
.await?;
529530

530531
Ok(())
531532
}

0 commit comments

Comments
 (0)