@@ -3,7 +3,7 @@ use clippy_utils::higher::VecArgs;
33use clippy_utils:: source:: snippet_opt;
44use clippy_utils:: ty:: is_type_diagnostic_item;
55use clippy_utils:: usage:: local_used_after_expr;
6- use clippy_utils:: { higher, path_to_local, path_to_local_id} ;
6+ use clippy_utils:: { higher, is_adjusted , path_to_local, path_to_local_id} ;
77use if_chain:: if_chain;
88use rustc_errors:: Applicability ;
99use rustc_hir:: def_id:: DefId ;
@@ -103,6 +103,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
103103 let closure_ty = cx. typeck_results ( ) . expr_ty ( expr) ;
104104
105105 if_chain ! (
106+ if !is_adjusted( cx, & body. value) ;
106107 if let ExprKind :: Call ( callee, args) = body. value. kind;
107108 if let ExprKind :: Path ( _) = callee. kind;
108109 if check_inputs( cx, body. params, args) ;
@@ -144,6 +145,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
144145 ) ;
145146
146147 if_chain ! (
148+ if !is_adjusted( cx, & body. value) ;
147149 if let ExprKind :: MethodCall ( path, args, _) = body. value. kind;
148150 if check_inputs( cx, body. params, args) ;
149151 let method_def_id = cx. typeck_results( ) . type_dependent_def_id( body. value. hir_id) . unwrap( ) ;
0 commit comments