File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,10 @@ impl EarlyLintPass for UnusedParens {
377377
378378 fn check_pat ( & mut self , cx : & EarlyContext , p : & ast:: Pat ) {
379379 use ast:: PatKind :: { Paren , Range } ;
380+ // The lint visitor will visit each subpattern of `p`. We do not want to lint any range
381+ // pattern no matter where it occurs in the pattern. For something like `&(a..=b)`, there
382+ // is a recursive `check_pat` on `a` and `b`, but we will assume that if there are
383+ // unnecessry parens they serve a purpose of readability.
380384 if let Paren ( ref pat) = p. node {
381385 match pat. node {
382386 Range ( ..) => { }
Original file line number Diff line number Diff line change 1111// run-pass
1212
1313fn main ( ) {
14+ #[ allow( unused_parens) ]
1415 match 0 {
15- pat => assert_eq ! ( pat, 0 )
16+ ( pat) => assert_eq ! ( pat, 0 )
1617 }
1718}
You can’t perform that action at this time.
0 commit comments