Skip to content

Commit 73cb9ab

Browse files
committed
rename hir::map::get_by_hir_id to get
1 parent a64456e commit 73cb9ab

File tree

44 files changed

+88
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+88
-88
lines changed

src/librustc/hir/map/blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> Code<'a> {
8484

8585
/// Attempts to construct a Code from presumed FnLike or Expr node input.
8686
pub fn from_node(map: &map::Map<'a>, id: ast::HirId) -> Option<Code<'a>> {
87-
match map.get_by_hir_id(id) {
87+
match map.get(id) {
8888
map::Node::Block(_) => {
8989
// Use the parent, hopefully an expression node.
9090
Code::from_node(map, map.get_parent_node_by_hir_id(id))

src/librustc/hir/map/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl<'hir> Map<'hir> {
458458
}
459459

460460
pub fn body_owner_kind(&self, id: HirId) -> BodyOwnerKind {
461-
match self.get_by_hir_id(id) {
461+
match self.get(id) {
462462
Node::Item(&Item { node: ItemKind::Const(..), .. }) |
463463
Node::TraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) |
464464
Node::ImplItem(&ImplItem { node: ImplItemKind::Const(..), .. }) |
@@ -482,7 +482,7 @@ impl<'hir> Map<'hir> {
482482
}
483483

484484
pub fn ty_param_owner(&self, id: HirId) -> HirId {
485-
match self.get_by_hir_id(id) {
485+
match self.get(id) {
486486
Node::Item(&Item { node: ItemKind::Trait(..), .. }) |
487487
Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => id,
488488
Node::GenericParam(_) => self.get_parent_node_by_hir_id(id),
@@ -491,7 +491,7 @@ impl<'hir> Map<'hir> {
491491
}
492492

493493
pub fn ty_param_name(&self, id: HirId) -> Name {
494-
match self.get_by_hir_id(id) {
494+
match self.get(id) {
495495
Node::Item(&Item { node: ItemKind::Trait(..), .. }) |
496496
Node::Item(&Item { node: ItemKind::TraitAlias(..), .. }) => kw::SelfUpper,
497497
Node::GenericParam(param) => param.name.ident().name,
@@ -561,14 +561,14 @@ impl<'hir> Map<'hir> {
561561
}
562562

563563
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
564-
pub fn get_by_hir_id(&self, id: HirId) -> Node<'hir> {
564+
pub fn get(&self, id: HirId) -> Node<'hir> {
565565
// read recorded by `find`
566566
self.find_by_hir_id(id).unwrap_or_else(||
567567
bug!("couldn't find hir id {} in the HIR map", id))
568568
}
569569

570570
pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
571-
self.as_local_hir_id(id).map(|id| self.get_by_hir_id(id)) // read recorded by `get`
571+
self.as_local_hir_id(id).map(|id| self.get(id)) // read recorded by `get`
572572
}
573573

574574
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics> {
@@ -840,7 +840,7 @@ impl<'hir> Map<'hir> {
840840
if scope == CRATE_HIR_ID {
841841
return Some(CRATE_HIR_ID);
842842
}
843-
match self.get_by_hir_id(scope) {
843+
match self.get(scope) {
844844
Node::Item(i) => {
845845
match i.node {
846846
ItemKind::Existential(ExistTy { impl_trait_fn: None, .. }) => {}
@@ -929,7 +929,7 @@ impl<'hir> Map<'hir> {
929929
}
930930

931931
pub fn name(&self, id: HirId) -> Name {
932-
match self.get_by_hir_id(id) {
932+
match self.get(id) {
933933
Node::Item(i) => i.ident.name,
934934
Node::ForeignItem(fi) => fi.ident.name,
935935
Node::ImplItem(ii) => ii.ident.name,
@@ -1061,7 +1061,7 @@ impl<'hir> Map<'hir> {
10611061
}
10621062

10631063
pub fn hir_to_pretty_string(&self, id: HirId) -> String {
1064-
print::to_string(self, |s| s.print_node(self.get_by_hir_id(id)))
1064+
print::to_string(self, |s| s.print_node(self.get(id)))
10651065
}
10661066
}
10671067

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13351335
// We do this to avoid suggesting code that ends up as `T: 'a'b`,
13361336
// instead we suggest `T: 'a + 'b` in that case.
13371337
let mut has_bounds = false;
1338-
if let Node::GenericParam(ref param) = hir.get_by_hir_id(id) {
1338+
if let Node::GenericParam(ref param) = hir.get(id) {
13391339
has_bounds = !param.bounds.is_empty();
13401340
}
13411341
let sp = hir.span(id);

src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
2929
if let Some(anon_reg) = self.tcx().is_suitable_region(region) {
3030
let def_id = anon_reg.def_id;
3131
if let Some(hir_id) = self.tcx().hir().as_local_hir_id(def_id) {
32-
let fndecl = match self.tcx().hir().get_by_hir_id(hir_id) {
32+
let fndecl = match self.tcx().hir().get(hir_id) {
3333
Node::Item(&hir::Item {
3434
node: hir::ItemKind::Fn(ref fndecl, ..),
3535
..

src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
5252
if let Node::Expr(Expr {
5353
node: Closure(_, _, _, closure_span, None),
5454
..
55-
}) = hir.get_by_hir_id(hir_id) {
55+
}) = hir.get(hir_id) {
5656
let sup_sp = sup_origin.span();
5757
let origin_sp = origin.span();
5858
let mut err = self.tcx().sess.struct_span_err(

src/librustc/infer/opaque_types/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,8 @@ pub fn may_define_existential_type(
945945
let mut hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
946946
trace!(
947947
"may_define_existential_type(def={:?}, opaque_node={:?})",
948-
tcx.hir().get_by_hir_id(hir_id),
949-
tcx.hir().get_by_hir_id(opaque_hir_id)
948+
tcx.hir().get(hir_id),
949+
tcx.hir().get(opaque_hir_id)
950950
);
951951

952952
// Named existential types can be defined by any siblings or children of siblings.

src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
16301630
);
16311631

16321632
if self.ir.variable_is_shorthand(var) {
1633-
if let Node::Binding(pat) = self.ir.tcx.hir().get_by_hir_id(hir_id) {
1633+
if let Node::Binding(pat) = self.ir.tcx.hir().get(hir_id) {
16341634
// Handle `ref` and `ref mut`.
16351635
let spans = spans.iter()
16361636
.map(|_span| (pat.span, format!("{}: _", name)))

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl MutabilityCategory {
344344
tables: &ty::TypeckTables<'_>,
345345
id: hir::HirId,
346346
) -> MutabilityCategory {
347-
let ret = match tcx.hir().get_by_hir_id(id) {
347+
let ret = match tcx.hir().get(id) {
348348
Node::Binding(p) => match p.node {
349349
PatKind::Binding(..) => {
350350
let bm = *tables.pat_binding_modes()

src/librustc/middle/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl Scope {
190190
}
191191
let span = tcx.hir().span(hir_id);
192192
if let ScopeData::Remainder(first_statement_index) = self.data {
193-
if let Node::Block(ref blk) = tcx.hir().get_by_hir_id(hir_id) {
193+
if let Node::Block(ref blk) = tcx.hir().get(hir_id) {
194194
// Want span for scope starting after the
195195
// indexed statement and ending at end of
196196
// `blk`; reuse span of `blk` and shift `lo`
@@ -1368,7 +1368,7 @@ fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ScopeTree
13681368
// If the item is an associated const or a method,
13691369
// record its impl/trait parent, as it can also have
13701370
// lifetime parameters free in this body.
1371-
match tcx.hir().get_by_hir_id(id) {
1371+
match tcx.hir().get(id) {
13721372
Node::ImplItem(_) |
13731373
Node::TraitItem(_) => {
13741374
visitor.scope_tree.root_parent = Some(tcx.hir().get_parent_item(id));

src/librustc/middle/resolve_lifetime.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
14881488
}
14891489
}
14901490
};
1491-
if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get_by_hir_id(lifetime.hir_id) {
1491+
if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get(lifetime.hir_id) {
14921492
if let Some(parent) = self.tcx.hir().find_by_hir_id(
14931493
self.tcx.hir().get_parent_item(hir_lifetime.hir_id))
14941494
{
@@ -1569,7 +1569,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
15691569
Some(LifetimeUseSet::One(lifetime)) => {
15701570
let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap();
15711571
debug!("hir id first={:?}", hir_id);
1572-
if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) {
1572+
if let Some((id, span, name)) = match self.tcx.hir().get(hir_id) {
15731573
Node::Lifetime(hir_lifetime) => Some((
15741574
hir_lifetime.hir_id,
15751575
hir_lifetime.span,
@@ -1620,7 +1620,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
16201620
}
16211621
None => {
16221622
let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap();
1623-
if let Some((id, span, name)) = match self.tcx.hir().get_by_hir_id(hir_id) {
1623+
if let Some((id, span, name)) = match self.tcx.hir().get(hir_id) {
16241624
Node::Lifetime(hir_lifetime) => Some((
16251625
hir_lifetime.hir_id,
16261626
hir_lifetime.span,
@@ -1823,7 +1823,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
18231823
// Do not free early-bound regions, only late-bound ones.
18241824
} else if let Some(body_id) = outermost_body {
18251825
let fn_id = self.tcx.hir().body_owner(body_id);
1826-
match self.tcx.hir().get_by_hir_id(fn_id) {
1826+
match self.tcx.hir().get(fn_id) {
18271827
Node::Item(&hir::Item {
18281828
node: hir::ItemKind::Fn(..),
18291829
..
@@ -2052,7 +2052,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
20522052
let mut assoc_item_kind = None;
20532053
let mut impl_self = None;
20542054
let parent = self.tcx.hir().get_parent_node_by_hir_id(output.hir_id);
2055-
let body = match self.tcx.hir().get_by_hir_id(parent) {
2055+
let body = match self.tcx.hir().get(parent) {
20562056
// `fn` definitions and methods.
20572057
Node::Item(&hir::Item {
20582058
node: hir::ItemKind::Fn(.., body),

0 commit comments

Comments
 (0)