File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -163,8 +163,13 @@ pub fn lookup_conf_file() -> io::Result<Option<path::PathBuf>> {
163163 /// Possible filename to search for.
164164 const CONFIG_FILE_NAMES : [ & str ; 2 ] = [ ".clippy.toml" , "clippy.toml" ] ;
165165
166- let mut current = path:: PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR not set" ) ) ;
167-
166+ // Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
167+ // 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+ ) ;
168173 loop {
169174 for config_file_name in & CONFIG_FILE_NAMES {
170175 let config_file = current. join ( config_file_name) ;
You can’t perform that action at this time.
0 commit comments