@@ -648,10 +648,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
648648 }
649649 }
650650 }
651- let hir_map = self . infcx . tcx . hir ( ) ;
652651 let def_id = self . body . source . def_id ( ) ;
653652 let Some ( local_def_id) = def_id. as_local ( ) else { return } ;
654- let Some ( body) = hir_map . maybe_body_owned_by ( local_def_id) else { return } ;
653+ let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id) else { return } ;
655654
656655 let mut v = SuggestIndexOperatorAlternativeVisitor {
657656 assign_span : span,
@@ -749,7 +748,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
749748 // `fn foo(&x: &i32)` -> `fn foo(&(mut x): &i32)`
750749 let def_id = self . body . source . def_id ( ) ;
751750 if let Some ( local_def_id) = def_id. as_local ( )
752- && let Some ( body) = self . infcx . tcx . hir ( ) . maybe_body_owned_by ( local_def_id)
751+ && let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id)
753752 && let Some ( hir_id) = ( BindingFinder { span : pat_span } ) . visit_body ( & body) . break_value ( )
754753 && let node = self . infcx . tcx . hir_node ( hir_id)
755754 && let hir:: Node :: LetStmt ( hir:: LetStmt {
@@ -856,7 +855,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
856855 use hir:: ExprKind :: { AddrOf , Block , Call , MethodCall } ;
857856 use hir:: { BorrowKind , Expr } ;
858857
859- let hir_map = self . infcx . tcx . hir ( ) ;
858+ let tcx = self . infcx . tcx ;
860859 struct Finder {
861860 span : Span ,
862861 }
@@ -871,7 +870,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
871870 }
872871 }
873872 }
874- if let Some ( body) = hir_map . maybe_body_owned_by ( self . mir_def_id ( ) )
873+ if let Some ( body) = tcx . hir_maybe_body_owned_by ( self . mir_def_id ( ) )
875874 && let Block ( block, _) = body. value . kind
876875 {
877876 // `span` corresponds to the expression being iterated, find the `for`-loop desugared
@@ -884,17 +883,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
884883 MethodCall ( path_segment, _, _, span) => {
885884 // We have `for _ in iter.read_only_iter()`, try to
886885 // suggest `for _ in iter.mutable_iter()` instead.
887- let opt_suggestions = self
888- . infcx
889- . tcx
886+ let opt_suggestions = tcx
890887 . typeck ( path_segment. hir_id . owner . def_id )
891888 . type_dependent_def_id ( expr. hir_id )
892- . and_then ( |def_id| self . infcx . tcx . impl_of_method ( def_id) )
893- . map ( |def_id| self . infcx . tcx . associated_items ( def_id) )
889+ . and_then ( |def_id| tcx. impl_of_method ( def_id) )
890+ . map ( |def_id| tcx. associated_items ( def_id) )
894891 . map ( |assoc_items| {
895892 assoc_items
896893 . in_definition_order ( )
897- . map ( |assoc_item_def| assoc_item_def. ident ( self . infcx . tcx ) )
894+ . map ( |assoc_item_def| assoc_item_def. ident ( tcx) )
898895 . filter ( |& ident| {
899896 let original_method_ident = path_segment. ident ;
900897 original_method_ident != ident
@@ -942,7 +939,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
942939 let closure_span = tcx. def_span ( self . mir_def_id ( ) ) ;
943940 let fn_call_id = tcx. parent_hir_id ( closure_id) ;
944941 let node = tcx. hir_node ( fn_call_id) ;
945- let def_id = hir . enclosing_body_owner ( fn_call_id) ;
942+ let def_id = tcx . hir_enclosing_body_owner ( fn_call_id) ;
946943 let mut look_at_return = true ;
947944
948945 // If the HIR node is a function or method call gets the def ID
@@ -1275,7 +1272,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
12751272 } ) => {
12761273 let def_id = self . body . source . def_id ( ) ;
12771274 let hir_id = if let Some ( local_def_id) = def_id. as_local ( )
1278- && let Some ( body) = self . infcx . tcx . hir ( ) . maybe_body_owned_by ( local_def_id)
1275+ && let Some ( body) = self . infcx . tcx . hir_maybe_body_owned_by ( local_def_id)
12791276 {
12801277 BindingFinder { span : err_label_span } . visit_body ( & body) . break_value ( )
12811278 } else {
0 commit comments