Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b46f1c4

Browse files
committed
Don't trigger if a binding is in the else pattern
1 parent 2967127 commit b46f1c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clippy_lints/src/matches/single_match.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ fn form_exhaustive_matches<'a>(cx: &LateContext<'a>, ty: Ty<'a>, left: &Pat<'_>,
242242
}
243243
true
244244
},
245-
(PatKind::TupleStruct(..), PatKind::Path(_) | PatKind::TupleStruct(..)) => in_candidate_enum(cx, ty),
245+
(PatKind::TupleStruct(..), PatKind::Path(_)) => in_candidate_enum(cx, ty),
246+
(PatKind::TupleStruct(..), PatKind::TupleStruct(_, inner, _)) => {
247+
in_candidate_enum(cx, ty) && inner.iter().all(contains_only_wilds)
248+
},
246249
_ => false,
247250
}
248251
}

0 commit comments

Comments
 (0)