@@ -292,7 +292,7 @@ impl<'hir> Map<'hir> {
292292 }
293293
294294 fn def_kind ( & self , hir_id : HirId ) -> Option < DefKind > {
295- let node = if let Some ( node) = self . find_by_hir_id ( hir_id) {
295+ let node = if let Some ( node) = self . find ( hir_id) {
296296 node
297297 } else {
298298 return None
@@ -347,7 +347,7 @@ impl<'hir> Map<'hir> {
347347 if variant_data. ctor_hir_id ( ) . is_none ( ) {
348348 return None ;
349349 }
350- let ctor_of = match self . find_by_hir_id ( self . get_parent_node ( hir_id) ) {
350+ let ctor_of = match self . find ( self . get_parent_node ( hir_id) ) {
351351 Some ( Node :: Item ( ..) ) => def:: CtorOf :: Struct ,
352352 Some ( Node :: Variant ( ..) ) => def:: CtorOf :: Variant ,
353353 _ => unreachable ! ( ) ,
@@ -563,7 +563,7 @@ impl<'hir> Map<'hir> {
563563 /// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
564564 pub fn get ( & self , id : HirId ) -> Node < ' hir > {
565565 // read recorded by `find`
566- self . find_by_hir_id ( id) . unwrap_or_else ( ||
566+ self . find ( id) . unwrap_or_else ( ||
567567 bug ! ( "couldn't find hir id {} in the HIR map" , id) )
568568 }
569569
@@ -595,7 +595,7 @@ impl<'hir> Map<'hir> {
595595 }
596596
597597 /// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
598- pub fn find_by_hir_id ( & self , hir_id : HirId ) -> Option < Node < ' hir > > {
598+ pub fn find ( & self , hir_id : HirId ) -> Option < Node < ' hir > > {
599599 let result = self . find_entry ( hir_id) . and_then ( |entry| {
600600 if let Node :: Crate = entry. node {
601601 None
@@ -634,11 +634,11 @@ impl<'hir> Map<'hir> {
634634 /// Check if the node is an argument. An argument is a local variable whose
635635 /// immediate parent is an item or a closure.
636636 pub fn is_argument ( & self , id : HirId ) -> bool {
637- match self . find_by_hir_id ( id) {
637+ match self . find ( id) {
638638 Some ( Node :: Binding ( _) ) => ( ) ,
639639 _ => return false ,
640640 }
641- match self . find_by_hir_id ( self . get_parent_node ( id) ) {
641+ match self . find ( self . get_parent_node ( id) ) {
642642 Some ( Node :: Item ( _) ) |
643643 Some ( Node :: TraitItem ( _) ) |
644644 Some ( Node :: ImplItem ( _) ) => true ,
@@ -859,28 +859,28 @@ impl<'hir> Map<'hir> {
859859 }
860860
861861 pub fn expect_item ( & self , id : HirId ) -> & ' hir Item {
862- match self . find_by_hir_id ( id) { // read recorded by `find`
862+ match self . find ( id) { // read recorded by `find`
863863 Some ( Node :: Item ( item) ) => item,
864864 _ => bug ! ( "expected item, found {}" , self . node_to_string( id) )
865865 }
866866 }
867867
868868 pub fn expect_impl_item ( & self , id : HirId ) -> & ' hir ImplItem {
869- match self . find_by_hir_id ( id) {
869+ match self . find ( id) {
870870 Some ( Node :: ImplItem ( item) ) => item,
871871 _ => bug ! ( "expected impl item, found {}" , self . node_to_string( id) )
872872 }
873873 }
874874
875875 pub fn expect_trait_item ( & self , id : HirId ) -> & ' hir TraitItem {
876- match self . find_by_hir_id ( id) {
876+ match self . find ( id) {
877877 Some ( Node :: TraitItem ( item) ) => item,
878878 _ => bug ! ( "expected trait item, found {}" , self . node_to_string( id) )
879879 }
880880 }
881881
882882 pub fn expect_variant_data ( & self , id : HirId ) -> & ' hir VariantData {
883- match self . find_by_hir_id ( id) {
883+ match self . find ( id) {
884884 Some ( Node :: Item ( i) ) => {
885885 match i. node {
886886 ItemKind :: Struct ( ref struct_def, _) |
@@ -895,21 +895,21 @@ impl<'hir> Map<'hir> {
895895 }
896896
897897 pub fn expect_variant ( & self , id : HirId ) -> & ' hir Variant {
898- match self . find_by_hir_id ( id) {
898+ match self . find ( id) {
899899 Some ( Node :: Variant ( variant) ) => variant,
900900 _ => bug ! ( "expected variant, found {}" , self . node_to_string( id) ) ,
901901 }
902902 }
903903
904904 pub fn expect_foreign_item ( & self , id : HirId ) -> & ' hir ForeignItem {
905- match self . find_by_hir_id ( id) {
905+ match self . find ( id) {
906906 Some ( Node :: ForeignItem ( item) ) => item,
907907 _ => bug ! ( "expected foreign item, found {}" , self . node_to_string( id) )
908908 }
909909 }
910910
911911 pub fn expect_expr ( & self , id : HirId ) -> & ' hir Expr {
912- match self . find_by_hir_id ( id) { // read recorded by find
912+ match self . find ( id) { // read recorded by find
913913 Some ( Node :: Expr ( expr) ) => expr,
914914 _ => bug ! ( "expected expr, found {}" , self . node_to_string( id) )
915915 }
@@ -1015,7 +1015,7 @@ impl<'hir> Map<'hir> {
10151015 Some ( Node :: Pat ( pat) ) => pat. span ,
10161016 Some ( Node :: Arm ( arm) ) => arm. span ,
10171017 Some ( Node :: Block ( block) ) => block. span ,
1018- Some ( Node :: Ctor ( ..) ) => match self . find_by_hir_id (
1018+ Some ( Node :: Ctor ( ..) ) => match self . find (
10191019 self . get_parent_node ( hir_id) )
10201020 {
10211021 Some ( Node :: Item ( item) ) => item. span ,
@@ -1087,7 +1087,7 @@ impl<'a> NodesMatchingSuffix<'a> {
10871087 // chain, then returns `None`.
10881088 fn find_first_mod_parent < ' a > ( map : & ' a Map < ' _ > , mut id : HirId ) -> Option < ( HirId , Name ) > {
10891089 loop {
1090- if let Node :: Item ( item) = map. find_by_hir_id ( id) ? {
1090+ if let Node :: Item ( item) = map. find ( id) ? {
10911091 if item_is_mod ( & item) {
10921092 return Some ( ( id, item. ident . name ) )
10931093 }
@@ -1260,7 +1260,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
12601260 } )
12611261 } ;
12621262
1263- match map. find_by_hir_id ( id) {
1263+ match map. find ( id) {
12641264 Some ( Node :: Item ( item) ) => {
12651265 let item_str = match item. node {
12661266 ItemKind :: ExternCrate ( ..) => "extern crate" ,
0 commit comments