about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMicha White <botahamec@outlook.com>2022-06-09 20:01:22 -0400
committerMicha White <botahamec@outlook.com>2022-06-10 13:12:02 -0400
commitb46f1c4a7fa5c0705cc65953e9887c4449aa8cba (patch)
tree65b6f224208b37c8e6a30a86da96849d0aa5974b
parent2967127de2b99957cb03a3af741e797710eae534 (diff)
downloadrust-b46f1c4a7fa5c0705cc65953e9887c4449aa8cba.tar.gz
rust-b46f1c4a7fa5c0705cc65953e9887c4449aa8cba.zip
Don't trigger if a binding is in the else pattern
-rw-r--r--clippy_lints/src/matches/single_match.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/clippy_lints/src/matches/single_match.rs b/clippy_lints/src/matches/single_match.rs
index 7d1ff208729..e67ef2a2c3a 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,
     }
 }