@@ -809,7 +809,7 @@ pub struct DerefClosure {
809
809
///
810
810
/// note: this only works on single line immutable closures with exactly one input parameter.
811
811
pub fn deref_closure_args ( cx : & LateContext < ' _ > , closure : & hir:: Expr < ' _ > ) -> Option < DerefClosure > {
812
- if let hir:: ExprKind :: Closure ( & Closure { fn_decl, body, .. } ) = closure. kind {
812
+ if let hir:: ExprKind :: Closure ( & Closure { fn_decl, def_id , body, .. } ) = closure. kind {
813
813
let closure_body = cx. tcx . hir ( ) . body ( body) ;
814
814
// is closure arg a type annotated double reference (i.e.: `|x: &&i32| ...`)
815
815
// a type annotation is present if param `kind` is different from `TyKind::Infer`
@@ -829,10 +829,8 @@ pub fn deref_closure_args(cx: &LateContext<'_>, closure: &hir::Expr<'_>) -> Opti
829
829
applicability : Applicability :: MachineApplicable ,
830
830
} ;
831
831
832
- let fn_def_id = cx. tcx . hir ( ) . local_def_id ( closure. hir_id ) ;
833
832
let infcx = cx. tcx . infer_ctxt ( ) . build ( ) ;
834
- ExprUseVisitor :: new ( & mut visitor, & infcx, fn_def_id, cx. param_env , cx. typeck_results ( ) )
835
- . consume_body ( closure_body) ;
833
+ ExprUseVisitor :: new ( & mut visitor, & infcx, def_id, cx. param_env , cx. typeck_results ( ) ) . consume_body ( closure_body) ;
836
834
837
835
if !visitor. suggestion_start . is_empty ( ) {
838
836
return Some ( DerefClosure {
0 commit comments