Skip to content

Commit c652ca7

Browse files
Update clippy_lints/src/loops/manual_flatten.rs
Co-authored-by: Samuel Tardieu <[email protected]>
1 parent ef2be5c commit c652ca7

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

clippy_lints/src/loops/manual_flatten.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,8 @@ pub(super) fn check<'tcx>(
8383
}
8484

8585
fn contains_nested_tuple_struct(pats: &[Pat<'_>]) -> bool {
86-
for pat in pats {
87-
match pat.kind {
88-
PatKind::TupleStruct(_, _, _) => {
89-
return true;
90-
},
91-
PatKind::Tuple(pats, _) => {
92-
return contains_nested_tuple_struct(pats);
93-
},
94-
_ => {},
95-
}
96-
}
97-
false
86+
pats.iter().any(|pat| {
87+
matches!(pat.kind, PatKind::TupleStruct(..))
88+
|| matches!(pat.kind, PatKind::Tuple(pats, _) if contains_nested_tuple_struct(pats))
89+
})
9890
}

0 commit comments

Comments
 (0)