mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
wildcard_match_arm: expand lint scope.
We're not only working with Results.
This commit is contained in:
parent
1b3c3d073a
commit
20ba476ea8
1 changed files with 8 additions and 11 deletions
|
@ -464,17 +464,14 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) {
|
fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) {
|
||||||
let ex_ty = walk_ptrs_ty(cx.tables.expr_ty(ex));
|
for arm in arms {
|
||||||
if match_type(cx, ex_ty, &paths::RESULT) {
|
if is_wild(&arm.pats[0]) {
|
||||||
for arm in arms {
|
span_note_and_lint(cx,
|
||||||
if is_wild(&arm.pats[0]) {
|
WILDCARD_MATCH_ARM,
|
||||||
span_note_and_lint(cx,
|
arm.pats[0].span,
|
||||||
WILDCARD_MATCH_ARM,
|
"wildcard match will miss any future added variants.",
|
||||||
arm.pats[0].span,
|
arm.pats[0].span,
|
||||||
"wildcard match will miss any future added variants.",
|
"to resolve, match each variant explicitly");
|
||||||
arm.pats[0].span,
|
|
||||||
"to resolve, match each variant explicitly");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue