]> git.lizzy.rs Git - rust.git/commitdiff
Update non_expressive_names for or patterns
authorMatthew Jasper <mjjasper1@gmail.com>
Sun, 8 Sep 2019 10:40:04 +0000 (11:40 +0100)
committerMatthew Jasper <mjjasper1@gmail.com>
Sun, 8 Sep 2019 15:27:54 +0000 (16:27 +0100)
clippy_lints/src/non_expressive_names.rs

index a9977a93b323a2fabec1b90b7f81b6d1f8df49ae..88bf52b1e8db692857d778f033b77632aff03780 100644 (file)
@@ -136,6 +136,9 @@ fn visit_pat(&mut self, pat: &'tcx Pat) {
                     }
                 }
             },
+            // 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 @@ fn visit_arm(&mut self, arm: &'tcx Arm) {
         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));
         });