File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 1
1
use clippy_utils:: diagnostics:: span_lint;
2
- use rustc_ast:: ast:: { Expr , ExprKind } ;
2
+ use rustc_ast:: ast:: { Expr , ExprKind , MethodCall } ;
3
3
use rustc_lint:: { EarlyContext , EarlyLintPass } ;
4
4
use rustc_session:: declare_lint_pass;
5
5
@@ -42,18 +42,12 @@ impl EarlyLintPass for DoubleParens {
42
42
fn check_expr ( & mut self , cx : & EarlyContext < ' _ > , expr : & Expr ) {
43
43
let span = match & expr. kind {
44
44
ExprKind :: Paren ( in_paren) if matches ! ( in_paren. kind, ExprKind :: Paren ( _) | ExprKind :: Tup ( _) ) => expr. span ,
45
- ExprKind :: Call ( _, args)
45
+ ExprKind :: Call ( _, args) | ExprKind :: MethodCall ( box MethodCall { args , .. } )
46
46
if let [ args] = & * * args
47
47
&& let ExprKind :: Paren ( _) = args. kind =>
48
48
{
49
49
args. span
50
50
} ,
51
- ExprKind :: MethodCall ( call)
52
- if let [ arg] = & * call. args
53
- && let ExprKind :: Paren ( _) = arg. kind =>
54
- {
55
- arg. span
56
- } ,
57
51
_ => return ,
58
52
} ;
59
53
if !expr. span . from_expansion ( ) {
You can’t perform that action at this time.
0 commit comments