about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGeorgy Komarov <jubnzv@gmail.com>2022-01-21 07:28:40 +0300
committerGeorgy Komarov <jubnzv@gmail.com>2022-01-21 07:28:40 +0300
commit49ae73b450b61f0240e629ced2024a9474f35adc (patch)
treefcebefbd033d7cf043070de5e71dcb574487c30e
parenta0c50875202e8d13b70d4cf8e4d347ddb04b876c (diff)
downloadrust-49ae73b450b61f0240e629ced2024a9474f35adc.tar.gz
rust-49ae73b450b61f0240e629ced2024a9474f35adc.zip
matches: Simplify code
-rw-r--r--clippy_lints/src/matches.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs
index 9da05245069..be9eff4237b 100644
--- a/clippy_lints/src/matches.rs
+++ b/clippy_lints/src/matches.rs
@@ -877,14 +877,7 @@ fn check_single_match_opt_like(
 fn collect_pat_paths(acc: &mut Vec<String>, pat: &Pat<'_>) -> bool {
     match pat.kind {
         PatKind::Wild => true,
-        PatKind::Tuple(inner, _) => {
-            for p in inner {
-                if !collect_pat_paths(acc, p) {
-                    return false;
-                }
-            }
-            true
-        },
+        PatKind::Tuple(inner, _) => inner.iter().all(|p| collect_pat_paths(acc, p)),
         PatKind::TupleStruct(ref path, ..) => {
             acc.push(rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| {
                 s.print_qpath(path, false);