Skip to content

Commit 6a0af57

Browse files
committed
Don't lint redundant closure for any function call inserted by the compiler.
1 parent bee42e8 commit 6a0af57

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

clippy_lints/src/eta_reduction.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clippy_utils::usage::{local_used_after_expr, local_used_in};
66
use clippy_utils::{higher, is_adjusted, path_to_local, path_to_local_id};
77
use rustc_errors::Applicability;
88
use rustc_hir::def_id::DefId;
9-
use rustc_hir::{BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, TyKind, Unsafety};
9+
use rustc_hir::{BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPath, TyKind, Unsafety};
1010
use rustc_infer::infer::TyCtxtInferExt;
1111
use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::ty::subst::{GenericArg, GenericArgKind};
@@ -120,16 +120,8 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
120120

121121
match body.value.kind {
122122
ExprKind::Call(callee, args)
123-
if matches!(callee.kind, ExprKind::Path(..)) =>
123+
if matches!(callee.kind, ExprKind::Path(QPath::Resolved(..) | QPath::TypeRelative(..))) =>
124124
{
125-
if matches!(higher::Range::hir(body.value), Some(higher::Range {
126-
start: Some(_),
127-
end: Some(_),
128-
limits: rustc_ast::RangeLimits::Closed
129-
})) {
130-
return;
131-
}
132-
133125
let callee_ty = typeck.expr_ty(callee).peel_refs();
134126
if matches!(
135127
type_diagnostic_name(cx, callee_ty),

0 commit comments

Comments
 (0)