diff options
| author | Micha White <botahamec@outlook.com> | 2022-06-09 20:01:22 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-06-10 13:12:02 -0400 |
| commit | b46f1c4a7fa5c0705cc65953e9887c4449aa8cba (patch) | |
| tree | 65b6f224208b37c8e6a30a86da96849d0aa5974b | |
| parent | 2967127de2b99957cb03a3af741e797710eae534 (diff) | |
| download | rust-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.rs | 5 |
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, } } |
