Skip to content

Commit 73e412b

Browse files
committed
Auto merge of rust-lang#10592 - beetrees:parent-dir-bug-fix, r=giraffate
Fix bug with getting parent directories in `lookup_conf_file` Currently `lookup_conf_file` doesn't canonicalize the configuration directory before using [`PathBuf::pop`](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.pop) to get the parent directory. This isn't usually an issue when clippy is invoked via `cargo clippy` as `CARGO_MANIFEST_DIR` is already canonicalized. However, this currently causes `clippy-driver` to ignore any `clippy.toml` in any parent directories when `CARGO_MANIFEST_DIR` and `CLIPPY_CONF_DIR` are not set. changelog: Fix a bug that would cause parent directories not to be searched for `clippy.toml` when using `clippy-driver` directly.
2 parents 85d9f17 + 3b22352 commit 73e412b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/utils/conf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ pub fn lookup_conf_file() -> io::Result<(Option<PathBuf>, Vec<String>)> {
478478
// If neither of those exist, use ".".
479479
let mut current = env::var_os("CLIPPY_CONF_DIR")
480480
.or_else(|| env::var_os("CARGO_MANIFEST_DIR"))
481-
.map_or_else(|| PathBuf::from("."), PathBuf::from);
481+
.map_or_else(|| PathBuf::from("."), PathBuf::from)
482+
.canonicalize()?;
482483

483484
let mut found_config: Option<PathBuf> = None;
484485
let mut warnings = vec![];

0 commit comments

Comments
 (0)