@@ -11,7 +11,7 @@ use rustc_hir::{Closure, Expr, ExprKind, Param, PatKind, Unsafety};
11
11
use rustc_lint:: { LateContext , LateLintPass } ;
12
12
use rustc_middle:: ty:: adjustment:: { Adjust , Adjustment , AutoBorrow } ;
13
13
use rustc_middle:: ty:: binding:: BindingMode ;
14
- use rustc_middle:: ty:: { self , EarlyBinder , SubstsRef , Ty , TypeVisitable } ;
14
+ use rustc_middle:: ty:: { self , EarlyBinder , SubstsRef , Ty , TypeVisitableExt } ;
15
15
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
16
16
use rustc_span:: symbol:: sym;
17
17
@@ -108,7 +108,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
108
108
if check_inputs( cx, body. params, None , args) ;
109
109
let callee_ty = cx. typeck_results( ) . expr_ty_adjusted( callee) ;
110
110
let call_ty = cx. typeck_results( ) . type_dependent_def_id( body. value. hir_id)
111
- . map_or( callee_ty, |id| cx. tcx. type_of( id) ) ;
111
+ . map_or( callee_ty, |id| cx. tcx. type_of( id) . subst_identity ( ) ) ;
112
112
if check_sig( cx, closure_ty, call_ty) ;
113
113
let substs = cx. typeck_results( ) . node_substs( callee. hir_id) ;
114
114
// This fixes some false positives that I don't entirely understand
@@ -153,7 +153,7 @@ impl<'tcx> LateLintPass<'tcx> for EtaReduction {
153
153
if check_inputs( cx, body. params, Some ( receiver) , args) ;
154
154
let method_def_id = cx. typeck_results( ) . type_dependent_def_id( body. value. hir_id) . unwrap( ) ;
155
155
let substs = cx. typeck_results( ) . node_substs( body. value. hir_id) ;
156
- let call_ty = cx. tcx. bound_type_of ( method_def_id) . subst( cx. tcx, substs) ;
156
+ let call_ty = cx. tcx. type_of ( method_def_id) . subst( cx. tcx, substs) ;
157
157
if check_sig( cx, closure_ty, call_ty) ;
158
158
then {
159
159
span_lint_and_then( cx, REDUNDANT_CLOSURE_FOR_METHOD_CALLS , expr. span, "redundant closure" , |diag| {
@@ -233,7 +233,7 @@ fn get_ufcs_type_name<'tcx>(cx: &LateContext<'tcx>, method_def_id: DefId, substs
233
233
match assoc_item. container {
234
234
ty:: TraitContainer => cx. tcx . def_path_str ( def_id) ,
235
235
ty:: ImplContainer => {
236
- let ty = cx. tcx . type_of ( def_id) ;
236
+ let ty = cx. tcx . type_of ( def_id) . skip_binder ( ) ;
237
237
match ty. kind ( ) {
238
238
ty:: Adt ( adt, _) => cx. tcx . def_path_str ( adt. did ( ) ) ,
239
239
ty:: Array ( ..)
0 commit comments