Skip to content

Commit

Permalink
feat(config)!: remove implicit installation from resolve_toolchain()
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Aug 8, 2024
1 parent cde5e5e commit f131d6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ async fn which(
binary: &str,
toolchain: Option<ResolvableToolchainName>,
) -> Result<utils::ExitCode> {
let binary_path = cfg.resolve_toolchain(toolchain).await?.binary_file(binary);
let binary_path = cfg.resolve_toolchain(toolchain)?.binary_file(binary);

utils::assert_is_file(&binary_path)?;

Expand Down
11 changes: 6 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,17 +709,18 @@ impl<'a> Cfg<'a> {
Ok(Some(Toolchain::new(self, name)?.rustc_version()))
}

pub(crate) async fn resolve_toolchain(
pub(crate) fn resolve_toolchain(
&self,
name: Option<ResolvableToolchainName>,
) -> Result<Toolchain<'_>> {
Ok(match name {
let toolchain = match name {
Some(name) => {
let desc = name.resolve(&self.get_default_host_triple()?)?;
Toolchain::new(self, desc.into())?
Some(desc.into())
}
None => self.find_or_install_active_toolchain(false).await?.0,
})
None => None,
};
self.local_toolchain(toolchain)
}

pub(crate) fn resolve_local_toolchain(
Expand Down

0 comments on commit f131d6e

Please sign in to comment.