- if let ExprKind::Call(ref paren, _) = expr.node {
- if let ExprKind::Paren(ref closure) = paren.node {
- if let ExprKind::Closure(_, ref decl, ref block, _) = closure.node {
- span_lint_and_then(cx,
- REDUNDANT_CLOSURE_CALL,
- expr.span,
- "Try not to call a closure in the expression where it is declared.",
- |db| {
- if decl.inputs.is_empty() {
- let hint = format!("{}", snippet(cx, block.span, ".."));
- db.span_suggestion(expr.span, "Try doing something like: ", hint);
- }
- });
+ match expr.node {
+ ExprKind::Call(ref paren, _) => {
+ if let ExprKind::Paren(ref closure) = paren.node {
+ if let ExprKind::Closure(_, ref decl, ref block, _) = closure.node {
+ span_lint_and_then(cx,
+ REDUNDANT_CLOSURE_CALL,
+ expr.span,
+ "Try not to call a closure in the expression where it is declared.",
+ |db| {
+ if decl.inputs.is_empty() {
+ let hint = format!("{}", snippet(cx, block.span, ".."));
+ db.span_suggestion(expr.span, "Try doing something like: ", hint);
+ }
+ });
+ }