Skip to content

Commit

Permalink
Inline trivial single-use function Cfg::which_binary()
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jun 5, 2024
1 parent 21ade95 commit 527678e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,8 @@ async fn which(
let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?;
Toolchain::new(cfg, desc.into())?.binary_file(binary)
} else {
cfg.which_binary(binary).await?
let (toolchain, _) = cfg.find_or_install_active_toolchain().await?;
toolchain.binary_file(binary)
};

utils::assert_is_file(&binary_path)?;
Expand Down
5 changes: 0 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,6 @@ impl Cfg {
Ok(self.update_hash_dir.join(toolchain.to_string()))
}

pub(crate) async fn which_binary(&self, binary: &str) -> Result<PathBuf> {
let (toolchain, _) = self.find_or_install_active_toolchain().await?;
Ok(toolchain.binary_file(binary))
}

#[cfg_attr(feature = "otel", tracing::instrument(skip_all))]
pub(crate) fn upgrade_data(&self) -> Result<()> {
let current_version = self.settings_file.with(|s| Ok(s.version.clone()))?;
Expand Down

0 comments on commit 527678e

Please sign in to comment.