From 527678ec9d8182196116331bd9bc9939de585afe Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 5 Jun 2024 10:41:34 +0200 Subject: [PATCH] Inline trivial single-use function Cfg::which_binary() --- src/cli/rustup_mode.rs | 3 ++- src/config.rs | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 5101d4b549..347cd973eb 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -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)?; diff --git a/src/config.rs b/src/config.rs index ee44c8b7a0..3356ac28da 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 { - 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()))?;