File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -743,7 +743,8 @@ fn default_(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
743
743
let toolchain = cfg. get_toolchain ( toolchain, false ) ?;
744
744
745
745
let status = if !toolchain. is_custom ( ) {
746
- Some ( toolchain. install_from_dist_if_not_installed ( ) ?)
746
+ let distributable = DistributableToolchain :: new ( & toolchain) ?;
747
+ Some ( distributable. install_from_dist_if_not_installed ( ) ?)
747
748
} else if !toolchain. exists ( ) {
748
749
return Err ( ErrorKind :: ToolchainNotInstalled ( toolchain. name ( ) . to_string ( ) ) . into ( ) ) ;
749
750
} else {
@@ -1251,7 +1252,8 @@ fn override_add(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
1251
1252
let toolchain = cfg. get_toolchain ( toolchain, false ) ?;
1252
1253
1253
1254
let status = if !toolchain. is_custom ( ) {
1254
- Some ( toolchain. install_from_dist_if_not_installed ( ) ?)
1255
+ let distributable = DistributableToolchain :: new ( & toolchain) ?;
1256
+ Some ( distributable. install_from_dist_if_not_installed ( ) ?)
1255
1257
} else if !toolchain. exists ( ) {
1256
1258
return Err ( ErrorKind :: ToolchainNotInstalled ( toolchain. name ( ) . to_string ( ) ) . into ( ) ) ;
1257
1259
} else {
Original file line number Diff line number Diff line change @@ -184,22 +184,6 @@ impl<'a> Toolchain<'a> {
184
184
}
185
185
}
186
186
187
- // Distributable only. Installed or not installed.
188
- pub fn install_from_dist_if_not_installed ( & self ) -> Result < UpdateStatus > {
189
- let update_hash = self . update_hash ( ) ?;
190
- self . install_if_not_installed ( InstallMethod :: Dist (
191
- & self . desc ( ) ?,
192
- self . cfg . get_profile ( ) ?,
193
- update_hash. as_ref ( ) . map ( |p| & * * p) ,
194
- self . download_cfg ( ) ,
195
- false ,
196
- false ,
197
- false ,
198
- None ,
199
- & [ ] ,
200
- & [ ] ,
201
- ) )
202
- }
203
187
// Custom only
204
188
pub fn is_custom ( & self ) -> bool {
205
189
ToolchainDesc :: from_str ( & self . name ) . is_err ( )
@@ -757,6 +741,23 @@ impl<'a> DistributableToolchain<'a> {
757
741
) )
758
742
}
759
743
744
+ // Installed or not installed.
745
+ pub fn install_from_dist_if_not_installed ( & self ) -> Result < UpdateStatus > {
746
+ let update_hash = self . 0 . update_hash ( ) ?;
747
+ self . 0 . install_if_not_installed ( InstallMethod :: Dist (
748
+ & self . 0 . desc ( ) ?,
749
+ self . 0 . cfg . get_profile ( ) ?,
750
+ update_hash. as_ref ( ) . map ( |p| & * * p) ,
751
+ self . 0 . download_cfg ( ) ,
752
+ false ,
753
+ false ,
754
+ false ,
755
+ None ,
756
+ & [ ] ,
757
+ & [ ] ,
758
+ ) )
759
+ }
760
+
760
761
// Installed only.
761
762
pub fn list_components ( & self ) -> Result < Vec < ComponentStatus > > {
762
763
if !self . 0 . exists ( ) {
You can’t perform that action at this time.
0 commit comments