Check if the CWD contains a config (previously it only checked parents)
This commit is contained in:
parent
e0e24c4e76
commit
5d07b63ce5
|
@ -54,14 +54,15 @@ fn lookup_project_file(input_file: &Path) -> io::Result<PathBuf> {
|
|||
// current = try!(fs::canonicalize(current));
|
||||
|
||||
loop {
|
||||
// If the current directory has no parent, we're done searching.
|
||||
if !current.pop() {
|
||||
return Err(io::Error::new(io::ErrorKind::NotFound, "Config not found"));
|
||||
}
|
||||
let config_file = current.join("rustfmt.toml");
|
||||
if fs::metadata(&config_file).is_ok() {
|
||||
return Ok(config_file);
|
||||
}
|
||||
|
||||
// If the current directory has no parent, we're done searching.
|
||||
if !current.pop() {
|
||||
return Err(io::Error::new(io::ErrorKind::NotFound, "Config not found"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue