Skip to content

Commit 6a6b4a3

Browse files
committed
combine the Call and MethodCall cases
1 parent dbef783 commit 6a6b4a3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/double_parens.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clippy_utils::diagnostics::span_lint;
2-
use rustc_ast::ast::{Expr, ExprKind};
2+
use rustc_ast::ast::{Expr, ExprKind, MethodCall};
33
use rustc_lint::{EarlyContext, EarlyLintPass};
44
use rustc_session::declare_lint_pass;
55

@@ -42,18 +42,12 @@ impl EarlyLintPass for DoubleParens {
4242
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
4343
let span = match &expr.kind {
4444
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, .. })
4646
if let [args] = &**args
4747
&& let ExprKind::Paren(_) = args.kind =>
4848
{
4949
args.span
5050
},
51-
ExprKind::MethodCall(call)
52-
if let [arg] = &*call.args
53-
&& let ExprKind::Paren(_) = arg.kind =>
54-
{
55-
arg.span
56-
},
5751
_ => return,
5852
};
5953
if !expr.span.from_expansion() {

0 commit comments

Comments
 (0)