Skip to content

Commit cbd2f7c

Browse files
rbtcollinsdjc
authored andcommitted
Make DistributableTool::install_if_not_installed async
1 parent 002d0f1 commit cbd2f7c

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ fn default_(cfg: &Cfg, toolchain: Option<MaybeResolvableToolchainName>) -> Resul
712712
}
713713
MaybeResolvableToolchainName::Some(ResolvableToolchainName::Official(toolchain)) => {
714714
let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?;
715-
let status = DistributableToolchain::install_if_not_installed(cfg, &desc)?;
715+
let status = utils::run_future(DistributableToolchain::install_if_not_installed(
716+
cfg, &desc,
717+
))?;
716718

717719
cfg.set_default(Some(&(&desc).into()))?;
718720

src/toolchain/distributable.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'a> DistributableToolchain<'a> {
357357
}
358358

359359
#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))]
360-
pub fn install_if_not_installed(
360+
pub async fn install_if_not_installed(
361361
cfg: &'a Cfg,
362362
desc: &'a ToolchainDesc,
363363
) -> anyhow::Result<UpdateStatus> {
@@ -366,15 +366,11 @@ impl<'a> DistributableToolchain<'a> {
366366
(cfg.notify_handler)(Notification::UsingExistingToolchain(desc));
367367
Ok(UpdateStatus::Unchanged)
368368
} else {
369-
Ok(utils::run_future(Self::install(
370-
cfg,
371-
desc,
372-
&[],
373-
&[],
374-
cfg.get_profile()?,
375-
false,
376-
))?
377-
.0)
369+
Ok(
370+
Self::install(cfg, desc, &[], &[], cfg.get_profile()?, false)
371+
.await?
372+
.0,
373+
)
378374
}
379375
}
380376

0 commit comments

Comments
 (0)