mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
Move only_used_in_recursion
back into complexity
This commit is contained in:
parent
d95b67560c
commit
39f4bee98e
5 changed files with 9 additions and 8 deletions
|
@ -252,6 +252,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
|
||||||
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
|
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
|
||||||
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
|
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
|
||||||
LintId::of(octal_escapes::OCTAL_ESCAPES),
|
LintId::of(octal_escapes::OCTAL_ESCAPES),
|
||||||
|
LintId::of(only_used_in_recursion::ONLY_USED_IN_RECURSION),
|
||||||
LintId::of(operators::ABSURD_EXTREME_COMPARISONS),
|
LintId::of(operators::ABSURD_EXTREME_COMPARISONS),
|
||||||
LintId::of(operators::ASSIGN_OP_PATTERN),
|
LintId::of(operators::ASSIGN_OP_PATTERN),
|
||||||
LintId::of(operators::BAD_BIT_MASK),
|
LintId::of(operators::BAD_BIT_MASK),
|
||||||
|
|
|
@ -72,6 +72,7 @@ store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec!
|
||||||
LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
|
LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
|
||||||
LintId::of(no_effect::NO_EFFECT),
|
LintId::of(no_effect::NO_EFFECT),
|
||||||
LintId::of(no_effect::UNNECESSARY_OPERATION),
|
LintId::of(no_effect::UNNECESSARY_OPERATION),
|
||||||
|
LintId::of(only_used_in_recursion::ONLY_USED_IN_RECURSION),
|
||||||
LintId::of(operators::DOUBLE_COMPARISONS),
|
LintId::of(operators::DOUBLE_COMPARISONS),
|
||||||
LintId::of(operators::DURATION_SUBSEC),
|
LintId::of(operators::DURATION_SUBSEC),
|
||||||
LintId::of(operators::IDENTITY_OP),
|
LintId::of(operators::IDENTITY_OP),
|
||||||
|
|
|
@ -24,7 +24,6 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
|
||||||
LintId::of(mutex_atomic::MUTEX_INTEGER),
|
LintId::of(mutex_atomic::MUTEX_INTEGER),
|
||||||
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
|
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
|
||||||
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
|
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
|
||||||
LintId::of(only_used_in_recursion::ONLY_USED_IN_RECURSION),
|
|
||||||
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
|
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
|
||||||
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
|
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
|
||||||
LintId::of(regex::TRIVIAL_REGEX),
|
LintId::of(regex::TRIVIAL_REGEX),
|
||||||
|
|
|
@ -80,7 +80,7 @@ declare_clippy_lint! {
|
||||||
/// ```
|
/// ```
|
||||||
#[clippy::version = "1.61.0"]
|
#[clippy::version = "1.61.0"]
|
||||||
pub ONLY_USED_IN_RECURSION,
|
pub ONLY_USED_IN_RECURSION,
|
||||||
nursery,
|
complexity,
|
||||||
"arguments that is only used in recursion can be removed"
|
"arguments that is only used in recursion can be removed"
|
||||||
}
|
}
|
||||||
impl_lint_pass!(OnlyUsedInRecursion => [ONLY_USED_IN_RECURSION]);
|
impl_lint_pass!(OnlyUsedInRecursion => [ONLY_USED_IN_RECURSION]);
|
||||||
|
|
|
@ -48,15 +48,15 @@ impl_lint_pass!(RedundantStaticLifetimes => [REDUNDANT_STATIC_LIFETIMES]);
|
||||||
|
|
||||||
impl RedundantStaticLifetimes {
|
impl RedundantStaticLifetimes {
|
||||||
// Recursively visit types
|
// Recursively visit types
|
||||||
fn visit_type(&mut self, ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
|
fn visit_type(ty: &Ty, cx: &EarlyContext<'_>, reason: &str) {
|
||||||
match ty.kind {
|
match ty.kind {
|
||||||
// Be careful of nested structures (arrays and tuples)
|
// Be careful of nested structures (arrays and tuples)
|
||||||
TyKind::Array(ref ty, _) | TyKind::Slice(ref ty) => {
|
TyKind::Array(ref ty, _) | TyKind::Slice(ref ty) => {
|
||||||
self.visit_type(ty, cx, reason);
|
Self::visit_type(ty, cx, reason);
|
||||||
},
|
},
|
||||||
TyKind::Tup(ref tup) => {
|
TyKind::Tup(ref tup) => {
|
||||||
for tup_ty in tup {
|
for tup_ty in tup {
|
||||||
self.visit_type(tup_ty, cx, reason);
|
Self::visit_type(tup_ty, cx, reason);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// This is what we are looking for !
|
// This is what we are looking for !
|
||||||
|
@ -87,7 +87,7 @@ impl RedundantStaticLifetimes {
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.visit_type(&borrow_type.ty, cx, reason);
|
Self::visit_type(&borrow_type.ty, cx, reason);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
@ -102,13 +102,13 @@ impl EarlyLintPass for RedundantStaticLifetimes {
|
||||||
|
|
||||||
if !item.span.from_expansion() {
|
if !item.span.from_expansion() {
|
||||||
if let ItemKind::Const(_, ref var_type, _) = item.kind {
|
if let ItemKind::Const(_, ref var_type, _) = item.kind {
|
||||||
self.visit_type(var_type, cx, "constants have by default a `'static` lifetime");
|
Self::visit_type(var_type, cx, "constants have by default a `'static` lifetime");
|
||||||
// Don't check associated consts because `'static` cannot be elided on those (issue
|
// Don't check associated consts because `'static` cannot be elided on those (issue
|
||||||
// #2438)
|
// #2438)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ItemKind::Static(ref var_type, _, _) = item.kind {
|
if let ItemKind::Static(ref var_type, _, _) = item.kind {
|
||||||
self.visit_type(var_type, cx, "statics have by default a `'static` lifetime");
|
Self::visit_type(var_type, cx, "statics have by default a `'static` lifetime");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue