@@ -809,7 +809,7 @@ pub struct DerefClosure {
809809///
810810/// note: this only works on single line immutable closures with exactly one input parameter.
811811pub 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 {
813813 let closure_body = cx. tcx . hir ( ) . body ( body) ;
814814 // is closure arg a type annotated double reference (i.e.: `|x: &&i32| ...`)
815815 // 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
829829 applicability : Applicability :: MachineApplicable ,
830830 } ;
831831
832- let fn_def_id = cx. tcx . hir ( ) . local_def_id ( closure. hir_id ) ;
833832 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) ;
836834
837835 if !visitor. suggestion_start . is_empty ( ) {
838836 return Some ( DerefClosure {
0 commit comments