Skip to content

Commit 7423c27

Browse files
committed
Don't lint redundant closure for any function call inserted by the compiler.
1 parent 4d80a2e commit 7423c27

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::{
@@ -119,16 +119,8 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
119119

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

0 commit comments

Comments
 (0)