@@ -16,7 +16,7 @@ use smallvec::SmallVec;
1616
1717use rustc_lint_defs:: builtin:: NAMED_ARGUMENTS_USED_POSITIONALLY ;
1818use rustc_lint_defs:: { BufferedEarlyLint , BuiltinLintDiagnostics , LintId } ;
19- use rustc_parse_format:: { Count , FormatSpec } ;
19+ use rustc_parse_format:: Count ;
2020use std:: borrow:: Cow ;
2121use std:: collections:: hash_map:: Entry ;
2222
@@ -985,20 +985,19 @@ fn lint_named_arguments_used_positionally(
985985 }
986986 _ => { }
987987 } ;
988- match a. format {
989- FormatSpec { width : Count :: CountIsName ( s, _) , .. }
990- | FormatSpec { precision : Count :: CountIsName ( s, _) , .. } => {
991- used_argument_names. insert ( s) ;
992- }
993- _ => { }
994- } ;
988+ if let Count :: CountIsName ( s, _) = a. format . width {
989+ used_argument_names. insert ( s) ;
990+ }
991+ if let Count :: CountIsName ( s, _) = a. format . precision {
992+ used_argument_names. insert ( s) ;
993+ }
995994 }
996995 }
997996
998997 for ( symbol, ( index, span) ) in names {
999998 if !used_argument_names. contains ( symbol. as_str ( ) ) {
1000999 let msg = format ! ( "named argument `{}` is not used by name" , symbol. as_str( ) ) ;
1001- let arg_span = cx. arg_spans [ index] ;
1000+ let arg_span = cx. arg_spans . get ( index) . copied ( ) . unwrap_or ( span ) ;
10021001 cx. ecx . buffered_early_lint . push ( BufferedEarlyLint {
10031002 span : MultiSpan :: from_span ( span) ,
10041003 msg : msg. clone ( ) ,
0 commit comments