File tree 1 file changed +21
-6
lines changed 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,17 @@ fn rustfmt(source: String) -> (String, String) {
26
26
static CHECK_RUSTFMT : Once = Once :: new ( ) ;
27
27
28
28
CHECK_RUSTFMT . call_once ( || {
29
- let have_working_rustfmt = process:: Command :: new ( "rustup" )
30
- . args ( & [ "run" , "nightly" , "rustfmt" , "--version" ] )
29
+ if env:: var_os ( "RUSTFMT" ) . is_some ( ) {
30
+ return ;
31
+ }
32
+
33
+ let mut rustfmt = {
34
+ let mut p = process:: Command :: new ( "rustup" ) ;
35
+ p. args ( & [ "run" , "nightly" , "rustfmt" , "--version" ] ) ;
36
+ p
37
+ } ;
38
+
39
+ let have_working_rustfmt = rustfmt
31
40
. stdout ( process:: Stdio :: null ( ) )
32
41
. stderr ( process:: Stdio :: null ( ) )
33
42
. status ( )
@@ -47,11 +56,17 @@ The latest `rustfmt` is required to run the `bindgen` test suite. Install
47
56
}
48
57
} ) ;
49
58
50
- let mut child = process:: Command :: new ( "rustup" )
59
+ let mut child = match env:: var_os ( "RUSTFMT" ) {
60
+ Some ( r) => process:: Command :: new ( r) ,
61
+ None => {
62
+ let mut p = process:: Command :: new ( "rustup" ) ;
63
+ p. args ( & [ "run" , "nightly" , "rustfmt" ] ) ;
64
+ p
65
+ }
66
+ } ;
67
+
68
+ let mut child = child
51
69
. args ( & [
52
- "run" ,
53
- "nightly" ,
54
- "rustfmt" ,
55
70
"--config-path" ,
56
71
concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/tests/rustfmt.toml" ) ,
57
72
] )
You can’t perform that action at this time.
0 commit comments