1 use clippy_utils::diagnostics::span_lint_and_help;
2 use clippy_utils::is_wild;
3 use rustc_hir::{Arm, PatKind};
4 use rustc_lint::LateContext;
6 use super::WILDCARD_IN_OR_PATTERNS;
8 pub(crate) fn check(cx: &LateContext<'_>, arms: &[Arm<'_>]) {
10 if let PatKind::Or(fields) = arm.pat.kind {
11 // look for multiple fields in this arm that contains at least one Wild pattern
12 if fields.len() > 1 && fields.iter().any(is_wild) {
15 WILDCARD_IN_OR_PATTERNS,
17 "wildcard pattern covers any other pattern as it will match anyway",
19 "consider handling `_` separately",