File tree 2 files changed +7
-20
lines changed
2 files changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,6 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
405
405
406
406
#[ doc( hidden) ]
407
407
pub fn read_conf ( sess : & Session ) -> Conf {
408
- use std:: path:: Path ;
409
408
let file_name = match utils:: conf:: lookup_conf_file ( ) {
410
409
Ok ( Some ( path) ) => path,
411
410
Ok ( None ) => return Conf :: default ( ) ,
@@ -416,16 +415,6 @@ pub fn read_conf(sess: &Session) -> Conf {
416
415
} ,
417
416
} ;
418
417
419
- let file_name = if file_name. is_relative ( ) {
420
- sess. local_crate_source_file
421
- . as_deref ( )
422
- . and_then ( Path :: parent)
423
- . unwrap_or_else ( || Path :: new ( "" ) )
424
- . join ( file_name)
425
- } else {
426
- file_name
427
- } ;
428
-
429
418
let TryConf { conf, errors } = utils:: conf:: read ( & file_name) ;
430
419
// all conf errors are non-fatal, we just use the default conf in case of error
431
420
for error in errors {
Original file line number Diff line number Diff line change @@ -210,15 +210,13 @@ pub fn lookup_conf_file() -> io::Result<Option<PathBuf>> {
210
210
. map_or_else ( || PathBuf :: from ( "." ) , PathBuf :: from) ;
211
211
loop {
212
212
for config_file_name in & CONFIG_FILE_NAMES {
213
- let config_file = current. join ( config_file_name) ;
214
- match fs:: metadata ( & config_file) {
215
- // Only return if it's a file to handle the unlikely situation of a directory named
216
- // `clippy.toml`.
217
- Ok ( ref md) if !md. is_dir ( ) => return Ok ( Some ( config_file) ) ,
218
- // Return the error if it's something other than `NotFound`; otherwise we didn't
219
- // find the project file yet, and continue searching.
220
- Err ( e) if e. kind ( ) != io:: ErrorKind :: NotFound => return Err ( e) ,
221
- _ => { } ,
213
+ if let Ok ( config_file) = current. join ( config_file_name) . canonicalize ( ) {
214
+ match fs:: metadata ( & config_file) {
215
+ Err ( e) if e. kind ( ) == io:: ErrorKind :: NotFound => { } ,
216
+ Err ( e) => return Err ( e) ,
217
+ Ok ( md) if md. is_dir ( ) => { } ,
218
+ Ok ( _) => return Ok ( Some ( config_file) ) ,
219
+ }
222
220
}
223
221
}
224
222
You can’t perform that action at this time.
0 commit comments