From 41f197460fbb2c4d87a12a99e61638a85850b28c Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Mon, 25 Feb 2019 13:40:28 +0100 Subject: [PATCH] redundant_closure does not trigger for external macros --- clippy_lints/src/eta_reduction.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index 87a82b2a169..05793f32c6c 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -1,7 +1,7 @@ use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then, type_is_unsafe_function}; use if_chain::if_chain; use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass}; use rustc::ty; use rustc::{declare_tool_lint, lint_array}; use rustc_errors::Applicability; @@ -45,6 +45,10 @@ impl LintPass for EtaPass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { + if in_external_macro(cx.sess(), expr.span) { + return; + } + match expr.node { ExprKind::Call(_, ref args) | ExprKind::MethodCall(_, _, ref args) => { for arg in args {