11use rustc_abi:: ExternAbi ;
2- use rustc_hir:: { self as hir, intravisit} ;
2+ use rustc_hir as hir;
3+ use rustc_hir:: def_id:: LocalDefId ;
4+ use rustc_hir:: intravisit:: FnKind ;
35use rustc_lint:: LateContext ;
46use rustc_span:: Span ;
57
@@ -10,39 +12,18 @@ use super::TOO_MANY_ARGUMENTS;
1012
1113pub ( super ) fn check_fn (
1214 cx : & LateContext < ' _ > ,
13- kind : intravisit :: FnKind < ' _ > ,
15+ kind : FnKind < ' _ > ,
1416 decl : & hir:: FnDecl < ' _ > ,
15- span : Span ,
1617 hir_id : hir:: HirId ,
18+ def_id : LocalDefId ,
1719 too_many_arguments_threshold : u64 ,
1820) {
1921 // don't warn for implementations, it's not their fault
20- if !is_trait_impl_item ( cx, hir_id) {
22+ if !is_trait_impl_item ( cx, hir_id)
2123 // don't lint extern functions decls, it's not their fault either
22- match kind {
23- intravisit:: FnKind :: Method (
24- _,
25- & hir:: FnSig {
26- header : hir:: FnHeader {
27- abi : ExternAbi :: Rust , ..
28- } ,
29- ..
30- } ,
31- )
32- | intravisit:: FnKind :: ItemFn (
33- _,
34- _,
35- hir:: FnHeader {
36- abi : ExternAbi :: Rust , ..
37- } ,
38- ) => check_arg_number (
39- cx,
40- decl,
41- span. with_hi ( decl. output . span ( ) . hi ( ) ) ,
42- too_many_arguments_threshold,
43- ) ,
44- _ => { } ,
45- }
24+ && kind. header ( ) . is_some_and ( |header| header. abi == ExternAbi :: Rust )
25+ {
26+ check_arg_number ( cx, decl, cx. tcx . def_span ( def_id) , too_many_arguments_threshold) ;
4627 }
4728}
4829
0 commit comments