From b46f1c4a7fa5c0705cc65953e9887c4449aa8cba Mon Sep 17 00:00:00 2001 From: Micha White Date: Thu, 9 Jun 2022 20:01:22 -0400 Subject: [PATCH] Don't trigger if a binding is in the else pattern --- clippy_lints/src/matches/single_match.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/matches/single_match.rs b/clippy_lints/src/matches/single_match.rs index 7d1ff2087..e67ef2a2c 100644 --- a/clippy_lints/src/matches/single_match.rs +++ b/clippy_lints/src/matches/single_match.rs @@ -242,7 +242,10 @@ fn form_exhaustive_matches<'a>(cx: &LateContext<'a>, ty: Ty<'a>, left: &Pat<'_>, } true }, - (PatKind::TupleStruct(..), PatKind::Path(_) | PatKind::TupleStruct(..)) => in_candidate_enum(cx, ty), + (PatKind::TupleStruct(..), PatKind::Path(_)) => in_candidate_enum(cx, ty), + (PatKind::TupleStruct(..), PatKind::TupleStruct(_, inner, _)) => { + in_candidate_enum(cx, ty) && inner.iter().all(contains_only_wilds) + }, _ => false, } }