File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -65,19 +65,17 @@ fn lookup_project_file(dir: &Path) -> FmtResult<Option<PathBuf>> {
65
65
loop {
66
66
let config_file = current. join ( "rustfmt.toml" ) ;
67
67
match fs:: metadata ( & config_file) {
68
- Ok ( md) => {
69
- // Properly handle unlikely situation of a directory named `rustfmt.toml`.
70
- if md. is_file ( ) {
71
- return Ok ( Some ( config_file) ) ;
72
- }
73
- }
74
- // If it's not found, we continue searching; otherwise something went wrong and we
75
- // return the error.
68
+ // Only return if it's a file to handle the unlikely situation of a directory named
69
+ // `rustfmt.toml`.
70
+ Ok ( ref md) if md. is_file ( ) => return Ok ( Some ( config_file) ) ,
71
+ // Return the error if it's something other than `NotFound`; otherwise we didn't find
72
+ // the project file yet, and continue searching.
76
73
Err ( e) => {
77
74
if e. kind ( ) != ErrorKind :: NotFound {
78
75
return Err ( FmtError :: from ( e) ) ;
79
76
}
80
77
}
78
+ _ => { }
81
79
}
82
80
83
81
// If the current directory has no parent, we're done searching.
You can’t perform that action at this time.
0 commit comments