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) {
3737 builder. add_defaults ( ) ;
3838 builder. select ( "rust" ) ;
3939 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) ) ;
4247 let rustfmt_config: RustfmtConfig = t ! ( toml:: from_str( & rustfmt_config) ) ;
4348 let mut ignore_fmt = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
4449 for ignore in rustfmt_config. ignore {
You can’t perform that action at this time.
0 commit comments