Skip to content

Commit 2141ebf

Browse files
committed
Auto merge of #3816 - g-bartoszek:redundant_closure_for_macros, r=Manishearth
do not trigger redundant_closure for external macros fixes #3791
2 parents 1ac6f4e + 41f1974 commit 2141ebf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/eta_reduction.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then, type_is_unsafe_function};
22
use if_chain::if_chain;
33
use rustc::hir::*;
4-
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
4+
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
55
use rustc::ty;
66
use rustc::{declare_tool_lint, lint_array};
77
use rustc_errors::Applicability;
@@ -45,6 +45,10 @@ impl LintPass for EtaPass {
4545

4646
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass {
4747
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
48+
if in_external_macro(cx.sess(), expr.span) {
49+
return;
50+
}
51+
4852
match expr.node {
4953
ExprKind::Call(_, ref args) | ExprKind::MethodCall(_, _, ref args) => {
5054
for arg in args {

0 commit comments

Comments
 (0)