@@ -833,12 +833,11 @@ pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind
833833 ExprKind :: Path ( QPath :: Resolved ( None , Path { res: Res :: Local ( _) , .. } ) )
834834 ) ) ;
835835
836- let map = cx. tcx . hir ( ) ;
837836 let mut child_id = e. hir_id ;
838837 let mut capture = CaptureKind :: Value ;
839838 let mut capture_expr_ty = e;
840839
841- for ( parent_id, parent) in map . parent_iter ( e. hir_id ) {
840+ for ( parent_id, parent) in cx . tcx . hir ( ) . parent_iter ( e. hir_id ) {
842841 if let [ Adjustment {
843842 kind : Adjust :: Deref ( _) | Adjust :: Borrow ( AutoBorrow :: Ref ( ..) ) ,
844843 target,
@@ -1224,8 +1223,7 @@ pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
12241223
12251224/// Gets the loop or closure enclosing the given expression, if any.
12261225pub fn get_enclosing_loop_or_closure ( tcx : TyCtxt < ' tcx > , expr : & Expr < ' _ > ) -> Option < & ' tcx Expr < ' tcx > > {
1227- let map = tcx. hir ( ) ;
1228- for ( _, node) in map. parent_iter ( expr. hir_id ) {
1226+ for ( _, node) in tcx. hir ( ) . parent_iter ( expr. hir_id ) {
12291227 match node {
12301228 Node :: Expr (
12311229 e
@@ -1244,8 +1242,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
12441242
12451243/// Gets the parent node if it's an impl block.
12461244pub fn get_parent_as_impl ( tcx : TyCtxt < ' _ > , id : HirId ) -> Option < & Impl < ' _ > > {
1247- let map = tcx. hir ( ) ;
1248- match map. parent_iter ( id) . next ( ) {
1245+ match tcx. hir ( ) . parent_iter ( id) . next ( ) {
12491246 Some ( (
12501247 _,
12511248 Node :: Item ( Item {
@@ -1259,8 +1256,7 @@ pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
12591256
12601257/// Checks if the given expression is the else clause of either an `if` or `if let` expression.
12611258pub fn is_else_clause ( tcx : TyCtxt < ' _ > , expr : & Expr < ' _ > ) -> bool {
1262- let map = tcx. hir ( ) ;
1263- let mut iter = map. parent_iter ( expr. hir_id ) ;
1259+ let mut iter = tcx. hir ( ) . parent_iter ( expr. hir_id ) ;
12641260 match iter. next ( ) {
12651261 Some ( (
12661262 _,
@@ -1794,9 +1790,8 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
17941790
17951791/// Gets the node where an expression is either used, or it's type is unified with another branch.
17961792pub fn get_expr_use_or_unification_node ( tcx : TyCtxt < ' tcx > , expr : & Expr < ' _ > ) -> Option < Node < ' tcx > > {
1797- let map = tcx. hir ( ) ;
17981793 let mut child_id = expr. hir_id ;
1799- let mut iter = map . parent_iter ( child_id) ;
1794+ let mut iter = tcx . hir ( ) . parent_iter ( child_id) ;
18001795 loop {
18011796 match iter. next ( ) {
18021797 None => break None ,
0 commit comments