@@ -110,7 +110,7 @@ pub fn main() -> Result<utils::ExitCode> {
110
110
cfg. set_toolchain_override ( & ResolvableToolchainName :: try_from ( & t[ 1 ..] ) ?) ;
111
111
}
112
112
113
- let toolchain = cfg. find_or_install_override_toolchain_or_default ( & cwd) ?. 0 ;
113
+ let toolchain = cfg. find_or_install_active_toolchain ( & cwd) ?. 0 ;
114
114
115
115
Ok ( toolchain. rustc_version ( ) )
116
116
}
@@ -1082,7 +1082,7 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1082
1082
let cwd = utils:: current_dir ( ) ?;
1083
1083
let installed_toolchains = cfg. list_toolchains ( ) ?;
1084
1084
// XXX: we may want a find_without_install capability for show.
1085
- let active_toolchain = cfg. find_or_install_override_toolchain_or_default ( & cwd) ;
1085
+ let active_toolchain = cfg. find_or_install_active_toolchain ( & cwd) ;
1086
1086
1087
1087
// active_toolchain will carry the reason we don't have one in its detail.
1088
1088
let active_targets = if let Ok ( ref at) = active_toolchain {
@@ -1175,16 +1175,10 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1175
1175
}
1176
1176
1177
1177
match active_toolchain {
1178
- Ok ( atc) => match atc {
1179
- ( ref toolchain, Some ( ref reason) ) => {
1180
- writeln ! ( t. lock( ) , "{} ({})" , toolchain. name( ) , reason) ?;
1181
- writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1182
- }
1183
- ( ref toolchain, None ) => {
1184
- writeln ! ( t. lock( ) , "{} (default)" , toolchain. name( ) ) ?;
1185
- writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1186
- }
1187
- } ,
1178
+ Ok ( ( ref toolchain, ref reason) ) => {
1179
+ writeln ! ( t. lock( ) , "{} ({})" , toolchain. name( ) , reason) ?;
1180
+ writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1181
+ }
1188
1182
Err ( err) => {
1189
1183
let root_cause = err. root_cause ( ) ;
1190
1184
if let Some ( RustupError :: ToolchainNotSelected ) =
@@ -1223,7 +1217,7 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1223
1217
fn show_active_toolchain ( cfg : & Cfg , m : & ArgMatches ) -> Result < utils:: ExitCode > {
1224
1218
let verbose = m. get_flag ( "verbose" ) ;
1225
1219
let cwd = utils:: current_dir ( ) ?;
1226
- match cfg. find_or_install_override_toolchain_or_default ( & cwd) {
1220
+ match cfg. find_or_install_active_toolchain ( & cwd) {
1227
1221
Err ( e) => {
1228
1222
let root_cause = e. root_cause ( ) ;
1229
1223
if let Some ( RustupError :: ToolchainNotSelected ) =
@@ -1234,16 +1228,12 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1234
1228
}
1235
1229
}
1236
1230
Ok ( ( toolchain, reason) ) => {
1237
- if let Some ( reason) = reason {
1238
- writeln ! (
1239
- process( ) . stdout( ) . lock( ) ,
1240
- "{} ({})" ,
1241
- toolchain. name( ) ,
1242
- reason
1243
- ) ?;
1244
- } else {
1245
- writeln ! ( process( ) . stdout( ) . lock( ) , "{} (default)" , toolchain. name( ) ) ?;
1246
- }
1231
+ writeln ! (
1232
+ process( ) . stdout( ) . lock( ) ,
1233
+ "{} ({})" ,
1234
+ toolchain. name( ) ,
1235
+ reason
1236
+ ) ?;
1247
1237
if verbose {
1248
1238
writeln ! ( process( ) . stdout( ) . lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1249
1239
}
@@ -1408,7 +1398,7 @@ fn explicit_or_dir_toolchain2(
1408
1398
}
1409
1399
None => {
1410
1400
let cwd = utils:: current_dir ( ) ?;
1411
- let ( toolchain, _) = cfg. find_or_install_override_toolchain_or_default ( & cwd) ?;
1401
+ let ( toolchain, _) = cfg. find_or_install_active_toolchain ( & cwd) ?;
1412
1402
1413
1403
Ok ( toolchain)
1414
1404
}
0 commit comments