@@ -672,17 +672,14 @@ where
672
672
F : Fn ( & [ & dyn AsRef < OsStr > ] , Option < & Path > , & Env ) -> Result < ( ) , String > ,
673
673
{
674
674
let toolchain = get_toolchain ( ) ?;
675
+ let toolchain_arg = format ! ( "+{}" , toolchain) ;
675
676
let rustc_version = String :: from_utf8 (
676
677
run_command_with_env ( & [ & args. config_info . rustc_command [ 0 ] , & "-V" ] , cwd, Some ( env) ) ?. stdout ,
677
678
)
678
679
. map_err ( |error| format ! ( "Failed to retrieve rustc version: {:?}" , error) ) ?;
679
680
let rustc_toolchain_version = String :: from_utf8 (
680
681
run_command_with_env (
681
- & [
682
- & args. config_info . rustc_command [ 0 ] ,
683
- & format ! ( "+{}" , toolchain) ,
684
- & "-V" ,
685
- ] ,
682
+ & [ & args. config_info . rustc_command [ 0 ] , & toolchain_arg, & "-V" ] ,
686
683
cwd,
687
684
Some ( env) ,
688
685
) ?
@@ -697,7 +694,7 @@ where
697
694
) ;
698
695
eprintln ! ( "Using `{}`." , rustc_toolchain_version) ;
699
696
}
700
- let mut cargo_command: Vec < & dyn AsRef < OsStr > > = vec ! [ & "cargo" , & toolchain ] ;
697
+ let mut cargo_command: Vec < & dyn AsRef < OsStr > > = vec ! [ & "cargo" , & toolchain_arg ] ;
701
698
cargo_command. extend_from_slice ( & command) ;
702
699
callback ( & cargo_command, cwd, env)
703
700
}
0 commit comments