@@ -111,7 +111,7 @@ pub fn main() -> Result<utils::ExitCode> {
111
111
cfg. set_toolchain_override ( & ResolvableToolchainName :: try_from ( & t[ 1 ..] ) ?) ;
112
112
}
113
113
114
- let toolchain = cfg. find_or_install_override_toolchain_or_default ( & cwd) ?. 0 ;
114
+ let toolchain = cfg. find_or_install_active_toolchain ( & cwd) ?. 0 ;
115
115
116
116
Ok ( toolchain. rustc_version ( ) )
117
117
}
@@ -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 {
@@ -1182,16 +1182,10 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1182
1182
}
1183
1183
1184
1184
match active_toolchain {
1185
- Ok ( atc) => match atc {
1186
- ( ref toolchain, Some ( ref reason) ) => {
1187
- writeln ! ( t. lock( ) , "{} ({})" , toolchain. name( ) , reason) ?;
1188
- writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1189
- }
1190
- ( ref toolchain, None ) => {
1191
- writeln ! ( t. lock( ) , "{} (default)" , toolchain. name( ) ) ?;
1192
- writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1193
- }
1194
- } ,
1185
+ Ok ( ( ref toolchain, ref reason) ) => {
1186
+ writeln ! ( t. lock( ) , "{} ({})" , toolchain. name( ) , reason) ?;
1187
+ writeln ! ( t. lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1188
+ }
1195
1189
Err ( err) => {
1196
1190
let root_cause = err. root_cause ( ) ;
1197
1191
if let Some ( RustupError :: ToolchainNotSelected ) =
@@ -1230,7 +1224,7 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1230
1224
fn show_active_toolchain ( cfg : & Cfg , m : & ArgMatches ) -> Result < utils:: ExitCode > {
1231
1225
let verbose = m. get_flag ( "verbose" ) ;
1232
1226
let cwd = utils:: current_dir ( ) ?;
1233
- match cfg. find_or_install_override_toolchain_or_default ( & cwd) {
1227
+ match cfg. find_or_install_active_toolchain ( & cwd) {
1234
1228
Err ( e) => {
1235
1229
let root_cause = e. root_cause ( ) ;
1236
1230
if let Some ( RustupError :: ToolchainNotSelected ) =
@@ -1241,16 +1235,12 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
1241
1235
}
1242
1236
}
1243
1237
Ok ( ( toolchain, reason) ) => {
1244
- if let Some ( reason) = reason {
1245
- writeln ! (
1246
- process( ) . stdout( ) . lock( ) ,
1247
- "{} ({})" ,
1248
- toolchain. name( ) ,
1249
- reason
1250
- ) ?;
1251
- } else {
1252
- writeln ! ( process( ) . stdout( ) . lock( ) , "{} (default)" , toolchain. name( ) ) ?;
1253
- }
1238
+ writeln ! (
1239
+ process( ) . stdout( ) . lock( ) ,
1240
+ "{} ({})" ,
1241
+ toolchain. name( ) ,
1242
+ reason
1243
+ ) ?;
1254
1244
if verbose {
1255
1245
writeln ! ( process( ) . stdout( ) . lock( ) , "{}" , toolchain. rustc_version( ) ) ?;
1256
1246
}
@@ -1416,7 +1406,7 @@ fn explicit_or_dir_toolchain2(
1416
1406
}
1417
1407
None => {
1418
1408
let cwd = utils:: current_dir ( ) ?;
1419
- let ( toolchain, _) = cfg. find_or_install_override_toolchain_or_default ( & cwd) ?;
1409
+ let ( toolchain, _) = cfg. find_or_install_active_toolchain ( & cwd) ?;
1420
1410
1421
1411
Ok ( toolchain)
1422
1412
}
0 commit comments