@@ -935,11 +935,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
935935 fn expected_fn_found_fn_mut_call ( & self , err : & mut Diag < ' _ > , sp : Span , act : & str ) {
936936 err. span_label ( sp, format ! ( "cannot {act}" ) ) ;
937937
938- let hir = self . infcx . tcx . hir ( ) ;
938+ let tcx = self . infcx . tcx ;
939+ let hir = tcx. hir ( ) ;
939940 let closure_id = self . mir_hir_id ( ) ;
940- let closure_span = self . infcx . tcx . def_span ( self . mir_def_id ( ) ) ;
941- let fn_call_id = self . infcx . tcx . parent_hir_id ( closure_id) ;
942- let node = self . infcx . tcx . hir_node ( fn_call_id) ;
941+ let closure_span = tcx. def_span ( self . mir_def_id ( ) ) ;
942+ let fn_call_id = tcx. parent_hir_id ( closure_id) ;
943+ let node = tcx. hir_node ( fn_call_id) ;
943944 let def_id = hir. enclosing_body_owner ( fn_call_id) ;
944945 let mut look_at_return = true ;
945946
@@ -950,7 +951,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
950951 return None ;
951952 } ;
952953
953- let typeck_results = self . infcx . tcx . typeck ( def_id) ;
954+ let typeck_results = tcx. typeck ( def_id) ;
954955
955956 match kind {
956957 hir:: ExprKind :: Call ( expr, args) => {
@@ -979,7 +980,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
979980 . map ( |( pos, _) | pos)
980981 . next ( ) ;
981982
982- let arg = match hir . get_if_local ( callee_def_id) {
983+ let arg = match tcx . hir_get_if_local ( callee_def_id) {
983984 Some (
984985 hir:: Node :: Item ( hir:: Item {
985986 ident, kind : hir:: ItemKind :: Fn { sig, .. } , ..
@@ -1021,7 +1022,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10211022 if look_at_return && hir. get_fn_id_for_return_block ( closure_id) . is_some ( ) {
10221023 // ...otherwise we are probably in the tail expression of the function, point at the
10231024 // return type.
1024- match self . infcx . tcx . hir_node_by_def_id ( hir. get_parent_item ( fn_call_id) . def_id ) {
1025+ match tcx. hir_node_by_def_id ( hir. get_parent_item ( fn_call_id) . def_id ) {
10251026 hir:: Node :: Item ( hir:: Item {
10261027 ident, kind : hir:: ItemKind :: Fn { sig, .. } , ..
10271028 } )
@@ -1049,9 +1050,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10491050
10501051 fn suggest_using_iter_mut ( & self , err : & mut Diag < ' _ > ) {
10511052 let source = self . body . source ;
1052- let hir = self . infcx . tcx . hir ( ) ;
10531053 if let InstanceKind :: Item ( def_id) = source. instance
1054- && let Some ( Node :: Expr ( hir:: Expr { hir_id, kind, .. } ) ) = hir. get_if_local ( def_id)
1054+ && let Some ( Node :: Expr ( hir:: Expr { hir_id, kind, .. } ) ) =
1055+ self . infcx . tcx . hir_get_if_local ( def_id)
10551056 && let ExprKind :: Closure ( hir:: Closure { kind : hir:: ClosureKind :: Closure , .. } ) = kind
10561057 && let Node :: Expr ( expr) = self . infcx . tcx . parent_hir_node ( * hir_id)
10571058 {
0 commit comments