Skip to content

Commit b63d211

Browse files
committed
Move show_version to DistributableToolchain
1 parent 6a04850 commit b63d211

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/cli/rustup_mode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,8 @@ fn check_updates(cfg: &Cfg) -> Result<()> {
782782
for channel in channels {
783783
match channel {
784784
(ref name, Ok(ref toolchain)) => {
785-
let current_version = toolchain.show_version()?;
785+
let distributable = DistributableToolchain::new(&toolchain)?;
786+
let current_version = distributable.show_version()?;
786787
let dist_version = toolchain.show_dist_version()?;
787788
let _ = t.attr(term2::Attr::Bold);
788789
write!(t, "{} - ", name)?;

src/toolchain.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,6 @@ impl<'a> Toolchain<'a> {
496496
})
497497
}
498498
// Distributable only. Installed only.
499-
pub fn show_version(&self) -> Result<Option<String>> {
500-
let distributable = DistributableToolchain::new(&self)?;
501-
match distributable.get_manifest()? {
502-
Some(manifest) => Ok(Some(manifest.get_rust_version()?.to_string())),
503-
None => Ok(None),
504-
}
505-
}
506-
// Distributable only. Installed only.
507499
pub fn show_dist_version(&self) -> Result<Option<String>> {
508500
let update_hash = self.update_hash()?;
509501

@@ -860,7 +852,7 @@ impl<'a> DistributableToolchain<'a> {
860852
}
861853

862854
// Installed only.
863-
pub fn get_manifest(&self) -> Result<Option<Manifest>> {
855+
fn get_manifest(&self) -> Result<Option<Manifest>> {
864856
if !self.0.exists() {
865857
return Err(ErrorKind::ToolchainNotInstalled(self.0.name().to_owned()).into());
866858
}
@@ -897,4 +889,12 @@ impl<'a> DistributableToolchain<'a> {
897889
targets,
898890
))
899891
}
892+
893+
// Installed only.
894+
pub fn show_version(&self) -> Result<Option<String>> {
895+
match self.get_manifest()? {
896+
Some(manifest) => Ok(Some(manifest.get_rust_version()?.to_string())),
897+
None => Ok(None),
898+
}
899+
}
900900
}

0 commit comments

Comments
 (0)