mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Merge pull request #576 from boblehest/check_cwd_for_config
Check if the CWD contains a config (previously it only checked parents)
This commit is contained in:
commit
5346daf541
@ -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 New Issue
Block a user