@@ -833,12 +833,11 @@ pub fn capture_local_usage(cx: &LateContext<'tcx>, e: &Expr<'_>) -> CaptureKind
833
833
ExprKind :: Path ( QPath :: Resolved ( None , Path { res: Res :: Local ( _) , .. } ) )
834
834
) ) ;
835
835
836
- let map = cx. tcx . hir ( ) ;
837
836
let mut child_id = e. hir_id ;
838
837
let mut capture = CaptureKind :: Value ;
839
838
let mut capture_expr_ty = e;
840
839
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 ) {
842
841
if let [ Adjustment {
843
842
kind : Adjust :: Deref ( _) | Adjust :: Borrow ( AutoBorrow :: Ref ( ..) ) ,
844
843
target,
@@ -1224,8 +1223,7 @@ pub fn get_enclosing_block<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio
1224
1223
1225
1224
/// Gets the loop or closure enclosing the given expression, if any.
1226
1225
pub 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 ) {
1229
1227
match node {
1230
1228
Node :: Expr (
1231
1229
e
@@ -1244,8 +1242,7 @@ pub fn get_enclosing_loop_or_closure(tcx: TyCtxt<'tcx>, expr: &Expr<'_>) -> Opti
1244
1242
1245
1243
/// Gets the parent node if it's an impl block.
1246
1244
pub 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 ( ) {
1249
1246
Some ( (
1250
1247
_,
1251
1248
Node :: Item ( Item {
@@ -1259,8 +1256,7 @@ pub fn get_parent_as_impl(tcx: TyCtxt<'_>, id: HirId) -> Option<&Impl<'_>> {
1259
1256
1260
1257
/// Checks if the given expression is the else clause of either an `if` or `if let` expression.
1261
1258
pub 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 ) ;
1264
1260
match iter. next ( ) {
1265
1261
Some ( (
1266
1262
_,
@@ -1794,9 +1790,8 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
1794
1790
1795
1791
/// Gets the node where an expression is either used, or it's type is unified with another branch.
1796
1792
pub fn get_expr_use_or_unification_node ( tcx : TyCtxt < ' tcx > , expr : & Expr < ' _ > ) -> Option < Node < ' tcx > > {
1797
- let map = tcx. hir ( ) ;
1798
1793
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) ;
1800
1795
loop {
1801
1796
match iter. next ( ) {
1802
1797
None => break None ,
0 commit comments