Skip to content

Commit 29d7007

Browse files
committed
cli: inline Cfg::active_rustc_version()
1 parent b33079d commit 29d7007

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/cli/rustup_mode.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,10 +1889,16 @@ async fn display_version(current_dir: PathBuf, process: &Process) -> Result<()>
18891889
.find_map(|arg| arg.strip_prefix('+').map(ResolvableToolchainName::try_from))
18901890
.transpose()?;
18911891

1892-
match cfg.active_rustc_version().await {
1893-
Ok(Some(version)) => info!("The currently active `rustc` version is `{version}`"),
1894-
Ok(None) => info!("No `rustc` is currently active"),
1895-
Err(err) => trace!("Failed to display the current `rustc` version: {err}"),
1892+
match cfg.maybe_ensure_active_toolchain(None).await {
1893+
Ok(Some((name, _))) => match Toolchain::new(&cfg, name) {
1894+
Ok(tc) => info!(
1895+
"the currently active `rustc` version is `{}`",
1896+
tc.rustc_version()
1897+
),
1898+
Err(err) => trace!("failed to display the current `rustc` version: {err}"),
1899+
},
1900+
Ok(None) => info!("no `rustc` is currently active"),
1901+
Err(err) => trace!("failed to display the current `rustc` version: {err}"),
18961902
}
18971903

18981904
Ok(())

src/config.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,6 @@ impl<'a> Cfg<'a> {
698698
}
699699
}
700700

701-
#[tracing::instrument(level = "trace")]
702-
pub(crate) async fn active_rustc_version(&mut self) -> Result<Option<String>> {
703-
let Some((name, _)) = self.maybe_ensure_active_toolchain(None).await? else {
704-
return Ok(None);
705-
};
706-
Ok(Some(Toolchain::new(self, name)?.rustc_version()))
707-
}
708-
709701
pub(crate) async fn local_toolchain(
710702
&self,
711703
name: Option<LocalToolchainName>,

0 commit comments

Comments
 (0)