@@ -347,7 +347,7 @@ impl<'hir> Map<'hir> {
347
347
if variant_data. ctor_hir_id ( ) . is_none ( ) {
348
348
return None ;
349
349
}
350
- let ctor_of = match self . find_by_hir_id ( self . get_parent_node_by_hir_id ( hir_id) ) {
350
+ let ctor_of = match self . find_by_hir_id ( self . get_parent_node ( hir_id) ) {
351
351
Some ( Node :: Item ( ..) ) => def:: CtorOf :: Struct ,
352
352
Some ( Node :: Variant ( ..) ) => def:: CtorOf :: Variant ,
353
353
_ => unreachable ! ( ) ,
@@ -424,7 +424,7 @@ impl<'hir> Map<'hir> {
424
424
/// which this is the body of, i.e., a `fn`, `const` or `static`
425
425
/// item (possibly associated), a closure, or a `hir::AnonConst`.
426
426
pub fn body_owner ( & self , BodyId { hir_id } : BodyId ) -> HirId {
427
- let parent = self . get_parent_node_by_hir_id ( hir_id) ;
427
+ let parent = self . get_parent_node ( hir_id) ;
428
428
assert ! ( self . lookup( parent) . map_or( false , |e| e. is_body_owner( hir_id) ) ) ;
429
429
parent
430
430
}
@@ -485,7 +485,7 @@ impl<'hir> Map<'hir> {
485
485
match self . get ( id) {
486
486
Node :: Item ( & Item { node : ItemKind :: Trait ( ..) , .. } ) |
487
487
Node :: Item ( & Item { node : ItemKind :: TraitAlias ( ..) , .. } ) => id,
488
- Node :: GenericParam ( _) => self . get_parent_node_by_hir_id ( id) ,
488
+ Node :: GenericParam ( _) => self . get_parent_node ( id) ,
489
489
_ => bug ! ( "ty_param_owner: {} not a type parameter" , self . node_to_string( id) )
490
490
}
491
491
}
@@ -625,7 +625,7 @@ impl<'hir> Map<'hir> {
625
625
/// never appear as the parent node. Thus, you can always walk the parent nodes
626
626
/// from a node to the root of the HIR (unless you get back the same ID here,
627
627
/// which can happen if the ID is not in the map itself or is just weird).
628
- pub fn get_parent_node_by_hir_id ( & self , hir_id : HirId ) -> HirId {
628
+ pub fn get_parent_node ( & self , hir_id : HirId ) -> HirId {
629
629
if self . dep_graph . is_fully_enabled ( ) {
630
630
let hir_id_owner = hir_id. owner ;
631
631
let def_path_hash = self . definitions . def_path_hash ( hir_id_owner) ;
@@ -644,7 +644,7 @@ impl<'hir> Map<'hir> {
644
644
Some ( Node :: Binding ( _) ) => ( ) ,
645
645
_ => return false ,
646
646
}
647
- match self . find_by_hir_id ( self . get_parent_node_by_hir_id ( id) ) {
647
+ match self . find_by_hir_id ( self . get_parent_node ( id) ) {
648
648
Some ( Node :: Item ( _) ) |
649
649
Some ( Node :: TraitItem ( _) ) |
650
650
Some ( Node :: ImplItem ( _) ) => true ,
@@ -680,7 +680,7 @@ impl<'hir> Map<'hir> {
680
680
{
681
681
let mut id = start_id;
682
682
loop {
683
- let parent_id = self . get_parent_node_by_hir_id ( id) ;
683
+ let parent_id = self . get_parent_node ( id) ;
684
684
if parent_id == CRATE_HIR_ID {
685
685
return Ok ( CRATE_HIR_ID ) ;
686
686
}
@@ -1022,7 +1022,7 @@ impl<'hir> Map<'hir> {
1022
1022
Some ( Node :: Arm ( arm) ) => arm. span ,
1023
1023
Some ( Node :: Block ( block) ) => block. span ,
1024
1024
Some ( Node :: Ctor ( ..) ) => match self . find_by_hir_id (
1025
- self . get_parent_node_by_hir_id ( hir_id) )
1025
+ self . get_parent_node ( hir_id) )
1026
1026
{
1027
1027
Some ( Node :: Item ( item) ) => item. span ,
1028
1028
Some ( Node :: Variant ( variant) ) => variant. span ,
0 commit comments