about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-09-08 11:40:04 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-09-08 16:27:54 +0100
commit5e7ff6b7058a5d6da2245145441f2ff2f9e69068 (patch)
treed44e5f3a738c5e04b14fa2ae3111f00551760113
parenta2477f775973e6625a1dd322e8934199beec02e0 (diff)
downloadrust-5e7ff6b7058a5d6da2245145441f2ff2f9e69068.tar.gz
rust-5e7ff6b7058a5d6da2245145441f2ff2f9e69068.zip
Update non_expressive_names for or patterns
-rw-r--r--clippy_lints/src/non_expressive_names.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs
index a9977a93b32..88bf52b1e8d 100644
--- a/clippy_lints/src/non_expressive_names.rs
+++ b/clippy_lints/src/non_expressive_names.rs
@@ -136,6 +136,9 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
                     }
                 }
             },
+            // just go through the first pattern, as either all patterns
+            // bind the same bindings or rustc would have errored much earlier
+            PatKind::Or(ref pats) => self.visit_pat(&pats[0]),
             _ => walk_pat(self, pat),
         }
     }
@@ -325,8 +328,6 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
         self.single_char_names.push(vec![]);
 
         self.apply(|this| {
-            // just go through the first pattern, as either all patterns
-            // bind the same bindings or rustc would have errored much earlier
             SimilarNamesNameVisitor(this).visit_pat(&arm.pat);
             this.apply(|this| walk_expr(this, &arm.body));
         });