File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,13 @@ use rustfmt_config_proc_macro::{nightly_only_test, rustfmt_only_ci_test};
99
1010/// Run the rustfmt executable and return its output.
1111fn rustfmt ( args : & [ & str ] ) -> ( String , String ) {
12- let mut bin_dir = env:: current_exe ( ) . unwrap ( ) ;
13- bin_dir. pop ( ) ; // chop off test exe name
14- if bin_dir. ends_with ( "deps" ) {
15- bin_dir. pop ( ) ;
16- }
17- let cmd = bin_dir. join ( format ! ( "rustfmt{}" , env:: consts:: EXE_SUFFIX ) ) ;
12+ let cmd = env ! ( "CARGO_BIN_EXE_rustfmt" ) ;
13+ let bin_dir = Path :: new ( cmd) . parent ( ) . unwrap ( ) ;
1814
1915 // Ensure the rustfmt binary runs from the local target dir.
2016 let path = env:: var_os ( "PATH" ) . unwrap_or_default ( ) ;
2117 let mut paths = env:: split_paths ( & path) . collect :: < Vec < _ > > ( ) ;
22- paths. insert ( 0 , bin_dir) ;
18+ paths. insert ( 0 , bin_dir. to_owned ( ) ) ;
2319 let new_path = env:: join_paths ( paths) . unwrap ( ) ;
2420
2521 match Command :: new ( & cmd) . args ( args) . env ( "PATH" , new_path) . output ( ) {
You can’t perform that action at this time.
0 commit comments