Merge pull request #790 from kamalmarhubi/handle-rustfmt-toml-dir
bin: Properly handle a directories named rustfmt.toml
This commit is contained in:
commit
02f38558cf
1 changed files with 5 additions and 2 deletions
|
@ -57,8 +57,11 @@ fn lookup_project_file(input_file: &Path) -> io::Result<PathBuf> {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let config_file = current.join("rustfmt.toml");
|
let config_file = current.join("rustfmt.toml");
|
||||||
if fs::metadata(&config_file).is_ok() {
|
if let Ok(md) = fs::metadata(&config_file) {
|
||||||
return Ok(config_file);
|
// Properly handle unlikely situation of a directory named `rustfmt.toml`.
|
||||||
|
if md.is_file() {
|
||||||
|
return Ok(config_file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current directory has no parent, we're done searching.
|
// If the current directory has no parent, we're done searching.
|
||||||
|
|
Loading…
Reference in a new issue