@@ -935,11 +935,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
935
935
fn expected_fn_found_fn_mut_call ( & self , err : & mut Diag < ' _ > , sp : Span , act : & str ) {
936
936
err. span_label ( sp, format ! ( "cannot {act}" ) ) ;
937
937
938
- let hir = self . infcx . tcx . hir ( ) ;
938
+ let tcx = self . infcx . tcx ;
939
+ let hir = tcx. hir ( ) ;
939
940
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) ;
943
944
let def_id = hir. enclosing_body_owner ( fn_call_id) ;
944
945
let mut look_at_return = true ;
945
946
@@ -950,7 +951,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
950
951
return None ;
951
952
} ;
952
953
953
- let typeck_results = self . infcx . tcx . typeck ( def_id) ;
954
+ let typeck_results = tcx. typeck ( def_id) ;
954
955
955
956
match kind {
956
957
hir:: ExprKind :: Call ( expr, args) => {
@@ -979,7 +980,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
979
980
. map ( |( pos, _) | pos)
980
981
. next ( ) ;
981
982
982
- let arg = match hir . get_if_local ( callee_def_id) {
983
+ let arg = match tcx . hir_get_if_local ( callee_def_id) {
983
984
Some (
984
985
hir:: Node :: Item ( hir:: Item {
985
986
ident, kind : hir:: ItemKind :: Fn { sig, .. } , ..
@@ -1021,7 +1022,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1021
1022
if look_at_return && hir. get_fn_id_for_return_block ( closure_id) . is_some ( ) {
1022
1023
// ...otherwise we are probably in the tail expression of the function, point at the
1023
1024
// 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 ) {
1025
1026
hir:: Node :: Item ( hir:: Item {
1026
1027
ident, kind : hir:: ItemKind :: Fn { sig, .. } , ..
1027
1028
} )
@@ -1049,9 +1050,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1049
1050
1050
1051
fn suggest_using_iter_mut ( & self , err : & mut Diag < ' _ > ) {
1051
1052
let source = self . body . source ;
1052
- let hir = self . infcx . tcx . hir ( ) ;
1053
1053
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)
1055
1056
&& let ExprKind :: Closure ( hir:: Closure { kind : hir:: ClosureKind :: Closure , .. } ) = kind
1056
1057
&& let Node :: Expr ( expr) = self . infcx . tcx . parent_hir_node ( * hir_id)
1057
1058
{
0 commit comments