Change lint name to WILDCARD_IN_OR_PATTERNS
This commit is contained in:
parent
58deaad42d
commit
8ae8b08e32
9 changed files with 25 additions and 25 deletions
|
|
@ -597,10 +597,10 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
|||
&matches::MATCH_OVERLAPPING_ARM,
|
||||
&matches::MATCH_REF_PATS,
|
||||
&matches::MATCH_WILD_ERR_ARM,
|
||||
&matches::PATS_WITH_WILD_MATCH_ARM,
|
||||
&matches::SINGLE_MATCH,
|
||||
&matches::SINGLE_MATCH_ELSE,
|
||||
&matches::WILDCARD_ENUM_MATCH_ARM,
|
||||
&matches::WILDCARD_IN_OR_PATTERNS,
|
||||
&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
|
||||
&mem_forget::MEM_FORGET,
|
||||
&mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
|
||||
|
|
@ -1188,8 +1188,8 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
|||
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
|
||||
LintId::of(&matches::MATCH_REF_PATS),
|
||||
LintId::of(&matches::MATCH_WILD_ERR_ARM),
|
||||
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
|
||||
LintId::of(&matches::SINGLE_MATCH),
|
||||
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
|
||||
LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
|
||||
LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
|
||||
LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
|
||||
|
|
@ -1463,7 +1463,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
|
|||
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
|
||||
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
|
||||
LintId::of(&matches::MATCH_AS_REF),
|
||||
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
|
||||
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
|
||||
LintId::of(&methods::CHARS_NEXT_CMP),
|
||||
LintId::of(&methods::CLONE_ON_COPY),
|
||||
LintId::of(&methods::FILTER_NEXT),
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ declare_clippy_lint! {
|
|||
/// "bar" | _ => {},
|
||||
/// }
|
||||
/// ```
|
||||
pub PATS_WITH_WILD_MATCH_ARM,
|
||||
pub WILDCARD_IN_OR_PATTERNS,
|
||||
complexity,
|
||||
"a wildcard pattern used with others patterns in same match arm"
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ declare_lint_pass!(Matches => [
|
|||
MATCH_WILD_ERR_ARM,
|
||||
MATCH_AS_REF,
|
||||
WILDCARD_ENUM_MATCH_ARM,
|
||||
PATS_WITH_WILD_MATCH_ARM
|
||||
WILDCARD_IN_OR_PATTERNS
|
||||
]);
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
|
||||
|
|
@ -267,7 +267,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
|
|||
check_wild_err_arm(cx, ex, arms);
|
||||
check_wild_enum_match(cx, ex, arms);
|
||||
check_match_as_ref(cx, ex, arms, expr);
|
||||
check_pats_wild_match(cx, ex, arms);
|
||||
check_wild_in_or_pats(cx, ex, arms);
|
||||
}
|
||||
if let ExprKind::Match(ref ex, ref arms, _) = expr.kind {
|
||||
check_match_ref_pats(cx, ex, arms, expr);
|
||||
|
|
@ -686,7 +686,7 @@ fn check_match_as_ref(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>],
|
|||
}
|
||||
}
|
||||
|
||||
fn check_pats_wild_match(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
|
||||
fn check_wild_in_or_pats(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
|
||||
let mut is_non_exhaustive_enum = false;
|
||||
let ty = cx.tables.expr_ty(ex);
|
||||
if ty.is_enum() {
|
||||
|
|
@ -703,7 +703,7 @@ fn check_pats_wild_match(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_
|
|||
if fields.len() > 1 && fields.iter().any(is_wild) {
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
PATS_WITH_WILD_MATCH_ARM,
|
||||
WILDCARD_IN_OR_PATTERNS,
|
||||
arm.pat.span,
|
||||
"wildcard pattern covers any other pattern as it will match anyway.",
|
||||
|db| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue