11use std:: collections:: VecDeque ;
22
33use clippy_utils:: diagnostics:: span_lint_and_sugg;
4+ use clippy_utils:: is_lint_allowed;
45use itertools:: { izip, Itertools } ;
56use rustc_ast:: { walk_list, Label , Mutability } ;
67use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
@@ -33,6 +34,9 @@ declare_clippy_lint! {
3334 /// and the assigned variables are also only in recursion, it is useless.
3435 ///
3536 /// ### Known problems
37+ /// Too many code paths in the linting code are currently untested and prone to produce false
38+ /// positives or are prone to have performance implications.
39+ ///
3640 /// In some cases, this would not catch all useless arguments.
3741 ///
3842 /// ```rust
@@ -85,7 +89,7 @@ declare_clippy_lint! {
8589 /// ```
8690 #[ clippy:: version = "1.60.0" ]
8791 pub ONLY_USED_IN_RECURSION ,
88- complexity ,
92+ nursery ,
8993 "arguments that is only used in recursion can be removed"
9094}
9195declare_lint_pass ! ( OnlyUsedInRecursion => [ ONLY_USED_IN_RECURSION ] ) ;
@@ -100,6 +104,9 @@ impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion {
100104 _: Span ,
101105 id : HirId ,
102106 ) {
107+ if is_lint_allowed ( cx, ONLY_USED_IN_RECURSION , id) {
108+ return ;
109+ }
103110 if let FnKind :: ItemFn ( ident, ..) | FnKind :: Method ( ident, ..) = kind {
104111 let def_id = id. owner . to_def_id ( ) ;
105112 let data = cx. tcx . def_path ( def_id) . data ;
0 commit comments