Skip to content

Commit 16dc703

Browse files
committed
Move show_dist_version to DistributableToolchain
1 parent fd35aae commit 16dc703

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/cli/rustup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ fn check_updates(cfg: &Cfg) -> Result<()> {
784784
(ref name, Ok(ref toolchain)) => {
785785
let distributable = DistributableToolchain::new(&toolchain)?;
786786
let current_version = distributable.show_version()?;
787-
let dist_version = toolchain.show_dist_version()?;
787+
let dist_version = distributable.show_dist_version()?;
788788
let _ = t.attr(term2::Attr::Bold);
789789
write!(t, "{} - ", name)?;
790790
match (current_version, dist_version) {

src/toolchain.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -496,19 +496,6 @@ impl<'a> Toolchain<'a> {
496496
})
497497
}
498498
// Distributable only. Installed only.
499-
pub fn show_dist_version(&self) -> Result<Option<String>> {
500-
let update_hash = self.update_hash()?;
501-
502-
match crate::dist::dist::dl_v2_manifest(
503-
self.download_cfg(),
504-
update_hash.as_ref().map(|p| &**p),
505-
&self.desc()?,
506-
)? {
507-
Some((manifest, _)) => Ok(Some(manifest.get_rust_version()?.to_string())),
508-
None => Ok(None),
509-
}
510-
}
511-
// Distributable only. Installed only.
512499
pub fn list_components(&self) -> Result<Option<Vec<ComponentStatus>>> {
513500
if !self.exists() {
514501
return Err(ErrorKind::ToolchainNotInstalled(self.name.to_owned()).into());
@@ -894,6 +881,20 @@ impl<'a> DistributableToolchain<'a> {
894881
}
895882
}
896883

884+
// Installed only.
885+
pub fn show_dist_version(&self) -> Result<Option<String>> {
886+
let update_hash = self.0.update_hash()?;
887+
888+
match crate::dist::dist::dl_v2_manifest(
889+
self.0.download_cfg(),
890+
update_hash.as_ref().map(|p| &**p),
891+
&self.0.desc()?,
892+
)? {
893+
Some((manifest, _)) => Ok(Some(manifest.get_rust_version()?.to_string())),
894+
None => Ok(None),
895+
}
896+
}
897+
897898
// Installed only.
898899
pub fn show_version(&self) -> Result<Option<String>> {
899900
match self.get_manifest()? {

0 commit comments

Comments
 (0)