File tree 2 files changed +6
-1
lines changed
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 {
377
377
378
378
fn check_pat ( & mut self , cx : & EarlyContext , p : & ast:: Pat ) {
379
379
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.
380
384
if let Paren ( ref pat) = p. node {
381
385
match pat. node {
382
386
Range ( ..) => { }
Original file line number Diff line number Diff line change 11
11
// run-pass
12
12
13
13
fn main ( ) {
14
+ #[ allow( unused_parens) ]
14
15
match 0 {
15
- pat => assert_eq ! ( pat, 0 )
16
+ ( pat) => assert_eq ! ( pat, 0 )
16
17
}
17
18
}
You can’t perform that action at this time.
0 commit comments