Also look in home directory for global config.

This commit is contained in:
Mara Bos 2019-01-14 11:20:46 +01:00
parent 13db34fb95
commit 635a4cdcdc
2 changed files with 9 additions and 2 deletions

View file

@ -349,7 +349,14 @@ macro_rules! create_config {
}
}
// If none was found, check in the global configuration directory.
// If nothing was found, check in the home directory.
if let Some(home_dir) = dirs::home_dir() {
if let Some(path) = get_toml_path(&home_dir)? {
return Ok(Some(path));
}
}
// If none was found ther either, check in the user's configuration directory.
if let Some(mut config_dir) = dirs::config_dir() {
config_dir.push("rustfmt");
if let Some(path) = get_toml_path(&config_dir)? {