@@ -399,56 +399,41 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore) {
399
399
}
400
400
401
401
#[ doc( hidden) ]
402
- pub fn read_conf ( args : & [ rustc_ast :: NestedMetaItem ] , sess : & Session ) -> Conf {
402
+ pub fn read_conf ( sess : & Session ) -> Conf {
403
403
use std:: path:: Path ;
404
- match utils:: conf:: file_from_args ( args) {
405
- Ok ( file_name) => {
406
- // if the user specified a file, it must exist, otherwise default to `clippy.toml` but
407
- // do not require the file to exist
408
- let file_name = match file_name {
409
- Some ( file_name) => file_name,
410
- None => match utils:: conf:: lookup_conf_file ( ) {
411
- Ok ( Some ( path) ) => path,
412
- Ok ( None ) => return Conf :: default ( ) ,
413
- Err ( error) => {
414
- sess. struct_err ( & format ! ( "error finding Clippy's configuration file: {}" , error) )
415
- . emit ( ) ;
416
- return Conf :: default ( ) ;
417
- } ,
418
- } ,
419
- } ;
420
-
421
- let file_name = if file_name. is_relative ( ) {
422
- sess. local_crate_source_file
423
- . as_deref ( )
424
- . and_then ( Path :: parent)
425
- . unwrap_or_else ( || Path :: new ( "" ) )
426
- . join ( file_name)
427
- } else {
428
- file_name
429
- } ;
404
+ let file_name = match utils:: conf:: lookup_conf_file ( ) {
405
+ Ok ( Some ( path) ) => path,
406
+ Ok ( None ) => return Conf :: default ( ) ,
407
+ Err ( error) => {
408
+ sess. struct_err ( & format ! ( "error finding Clippy's configuration file: {}" , error) )
409
+ . emit ( ) ;
410
+ return Conf :: default ( ) ;
411
+ } ,
412
+ } ;
430
413
431
- let ( conf, errors) = utils:: conf:: read ( & file_name) ;
414
+ let file_name = if file_name. is_relative ( ) {
415
+ sess. local_crate_source_file
416
+ . as_deref ( )
417
+ . and_then ( Path :: parent)
418
+ . unwrap_or_else ( || Path :: new ( "" ) )
419
+ . join ( file_name)
420
+ } else {
421
+ file_name
422
+ } ;
432
423
433
- // all conf errors are non-fatal, we just use the default conf in case of error
434
- for error in errors {
435
- sess. struct_err ( & format ! (
436
- "error reading Clippy's configuration file `{}`: {}" ,
437
- file_name. display( ) ,
438
- error
439
- ) )
440
- . emit ( ) ;
441
- }
424
+ let ( conf, errors) = utils:: conf:: read ( & file_name) ;
442
425
443
- conf
444
- } ,
445
- Err ( ( err , span ) ) => {
446
- sess . struct_span_err ( span , err )
447
- . span_note ( span , "Clippy will use default configuration" )
448
- . emit ( ) ;
449
- Conf :: default ( )
450
- } ,
426
+ // all conf errors are non-fatal, we just use the default conf in case of error
427
+ for error in errors {
428
+ sess . struct_err ( & format ! (
429
+ "error reading Clippy's configuration file `{}`: {}" ,
430
+ file_name . display ( ) ,
431
+ error
432
+ ) )
433
+ . emit ( ) ;
451
434
}
435
+
436
+ conf
452
437
}
453
438
454
439
/// Register all lints and lint groups with the rustc plugin registry
0 commit comments