File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,13 @@ pub fn format(build: &Build, check: bool) {
37
37
builder. add_defaults ( ) ;
38
38
builder. select ( "rust" ) ;
39
39
let matcher = builder. build ( ) . unwrap ( ) ;
40
-
41
- let rustfmt_config = t ! ( std:: fs:: read_to_string( build. src. join( "rustfmt.toml" ) ) ) ;
40
+ let rustfmt_config = build. src . join ( "rustfmt.toml" ) ;
41
+ if !rustfmt_config. exists ( ) {
42
+ eprintln ! ( "Not running formatting checks; rustfmt.toml does not exist." ) ;
43
+ eprintln ! ( "This may happen in distributed tarballs." ) ;
44
+ return ;
45
+ }
46
+ let rustfmt_config = t ! ( std:: fs:: read_to_string( & rustfmt_config) ) ;
42
47
let rustfmt_config: RustfmtConfig = t ! ( toml:: from_str( & rustfmt_config) ) ;
43
48
let mut ignore_fmt = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
44
49
for ignore in rustfmt_config. ignore {
You can’t perform that action at this time.
0 commit comments