We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71d03ae commit 86c513eCopy full SHA for 86c513e
clippy_lints/src/utils/conf.rs
@@ -163,8 +163,13 @@ pub fn lookup_conf_file() -> io::Result<Option<path::PathBuf>> {
163
/// Possible filename to search for.
164
const CONFIG_FILE_NAMES: [&str; 2] = [".clippy.toml", "clippy.toml"];
165
166
- let mut current = path::PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"));
167
-
+ // Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
+ // If neither of those exist, use ".".
168
+ let mut current = path::PathBuf::from(
169
+ env::var("CLIPPY_CONF_DIR")
170
+ .or_else(|_| env::var("CARGO_MANIFEST_DIR"))
171
+ .unwrap_or_else(|_| ".".to_string()),
172
+ );
173
loop {
174
for config_file_name in &CONFIG_FILE_NAMES {
175
let config_file = current.join(config_file_name);
0 commit comments