]> git.lizzy.rs Git - rust.git/commitdiff
HIR: rename find_by_hir_id to find
authorljedrz <ljedrz@gmail.com>
Mon, 24 Jun 2019 07:58:49 +0000 (09:58 +0200)
committerljedrz <ljedrz@gmail.com>
Mon, 24 Jun 2019 07:58:49 +0000 (09:58 +0200)
22 files changed:
src/librustc/hir/map/mod.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/opaque_types/mod.rs
src/librustc/middle/dead.rs
src/librustc/middle/liveness.rs
src/librustc/middle/reachable.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/context.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_driver/pretty.rs
src/librustc_lint/builtin.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/transform/check_unsafety.rs
src/librustc_passes/loops.rs
src/librustc_privacy/lib.rs
src/librustc_save_analysis/lib.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/coherence/builtin.rs
src/librustc_typeck/lib.rs

index ea18a73577cf069fc975cf5991c962d8f8b42acf..3d591c9a1c6bdafb28167b0c04587c4abdc44226 100644 (file)
@@ -292,7 +292,7 @@ pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId {
     }
 
     fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
-        let node = if let Some(node) = self.find_by_hir_id(hir_id) {
+        let node = if let Some(node) = self.find(hir_id) {
             node
         } else {
             return None
@@ -347,7 +347,7 @@ fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
                 if variant_data.ctor_hir_id().is_none() {
                     return None;
                 }
-                let ctor_of = match self.find_by_hir_id(self.get_parent_node(hir_id)) {
+                let ctor_of = match self.find(self.get_parent_node(hir_id)) {
                     Some(Node::Item(..)) => def::CtorOf::Struct,
                     Some(Node::Variant(..)) => def::CtorOf::Variant,
                     _ => unreachable!(),
@@ -563,7 +563,7 @@ pub fn visit_item_likes_in_module<V>(&self, module: DefId, visitor: &mut V)
     /// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
     pub fn get(&self, id: HirId) -> Node<'hir> {
         // read recorded by `find`
-        self.find_by_hir_id(id).unwrap_or_else(||
+        self.find(id).unwrap_or_else(||
             bug!("couldn't find hir id {} in the HIR map", id))
     }
 
@@ -595,7 +595,7 @@ pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics> {
     }
 
     /// Retrieves the `Node` corresponding to `id`, returning `None` if cannot be found.
-    pub fn find_by_hir_id(&self, hir_id: HirId) -> Option<Node<'hir>> {
+    pub fn find(&self, hir_id: HirId) -> Option<Node<'hir>> {
         let result = self.find_entry(hir_id).and_then(|entry| {
             if let Node::Crate = entry.node {
                 None
@@ -634,11 +634,11 @@ pub fn get_parent_node(&self, hir_id: HirId) -> HirId {
     /// Check if the node is an argument. An argument is a local variable whose
     /// immediate parent is an item or a closure.
     pub fn is_argument(&self, id: HirId) -> bool {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::Binding(_)) => (),
             _ => return false,
         }
-        match self.find_by_hir_id(self.get_parent_node(id)) {
+        match self.find(self.get_parent_node(id)) {
             Some(Node::Item(_)) |
             Some(Node::TraitItem(_)) |
             Some(Node::ImplItem(_)) => true,
@@ -859,28 +859,28 @@ pub fn get_foreign_abi(&self, hir_id: HirId) -> Abi {
     }
 
     pub fn expect_item(&self, id: HirId) -> &'hir Item {
-        match self.find_by_hir_id(id) { // read recorded by `find`
+        match self.find(id) { // read recorded by `find`
             Some(Node::Item(item)) => item,
             _ => bug!("expected item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_impl_item(&self, id: HirId) -> &'hir ImplItem {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::ImplItem(item)) => item,
             _ => bug!("expected impl item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_trait_item(&self, id: HirId) -> &'hir TraitItem {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::TraitItem(item)) => item,
             _ => bug!("expected trait item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::Item(i)) => {
                 match i.node {
                     ItemKind::Struct(ref struct_def, _) |
@@ -895,21 +895,21 @@ pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData {
     }
 
     pub fn expect_variant(&self, id: HirId) -> &'hir Variant {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::Variant(variant)) => variant,
             _ => bug!("expected variant, found {}", self.node_to_string(id)),
         }
     }
 
     pub fn expect_foreign_item(&self, id: HirId) -> &'hir ForeignItem {
-        match self.find_by_hir_id(id) {
+        match self.find(id) {
             Some(Node::ForeignItem(item)) => item,
             _ => bug!("expected foreign item, found {}", self.node_to_string(id))
         }
     }
 
     pub fn expect_expr(&self, id: HirId) -> &'hir Expr {
-        match self.find_by_hir_id(id) { // read recorded by find
+        match self.find(id) { // read recorded by find
             Some(Node::Expr(expr)) => expr,
             _ => bug!("expected expr, found {}", self.node_to_string(id))
         }
@@ -1015,7 +1015,7 @@ pub fn span(&self, hir_id: HirId) -> Span {
             Some(Node::Pat(pat)) => pat.span,
             Some(Node::Arm(arm)) => arm.span,
             Some(Node::Block(block)) => block.span,
-            Some(Node::Ctor(..)) => match self.find_by_hir_id(
+            Some(Node::Ctor(..)) => match self.find(
                 self.get_parent_node(hir_id))
             {
                 Some(Node::Item(item)) => item.span,
@@ -1087,7 +1087,7 @@ fn suffix_matches(&self, parent: HirId) -> bool {
         // chain, then returns `None`.
         fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: HirId) -> Option<(HirId, Name)> {
             loop {
-                if let Node::Item(item) = map.find_by_hir_id(id)? {
+                if let Node::Item(item) = map.find(id)? {
                     if item_is_mod(&item) {
                         return Some((id, item.ident.name))
                     }
@@ -1260,7 +1260,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
         })
     };
 
-    match map.find_by_hir_id(id) {
+    match map.find(id) {
         Some(Node::Item(item)) => {
             let item_str = match item.node {
                 ItemKind::ExternCrate(..) => "extern crate",
index d1e32b1dbad36761cf7a42b23896322be1334ebc..65225163a25a47111160a511f6c8374e2686d92b 100644 (file)
@@ -86,7 +86,7 @@ pub fn note_and_explain_region(
                     )
                 };
                 let span = scope.span(self, region_scope_tree);
-                let tag = match self.hir().find_by_hir_id(scope.hir_id(region_scope_tree)) {
+                let tag = match self.hir().find(scope.hir_id(region_scope_tree)) {
                     Some(Node::Block(_)) => "block",
                     Some(Node::Expr(expr)) => match expr.node {
                         hir::ExprKind::Call(..) => "call",
@@ -182,7 +182,7 @@ fn msg_span_from_early_bound_and_free_regions(
 
         let scope = region.free_region_binding_scope(self);
         let node = self.hir().as_local_hir_id(scope).unwrap_or(hir::DUMMY_HIR_ID);
-        let tag = match self.hir().find_by_hir_id(node) {
+        let tag = match self.hir().find(node) {
             Some(Node::Block(_)) | Some(Node::Expr(_)) => "body",
             Some(Node::Item(it)) => Self::item_scope_tag(&it),
             Some(Node::TraitItem(it)) => Self::trait_item_scope_tag(&it),
index a687b0e459100d7a084e3d99c6980ad3c05cc97e..6b6dbd43167fa3fadad4d89583a6a48a770295f6 100644 (file)
@@ -777,7 +777,7 @@ fn instantiate_opaque_types_in_map<T: TypeFoldable<'tcx>>(&mut self, value: &T)
                                                 .local_def_id_from_hir_id(opaque_parent_hir_id)
                         };
                         let (in_definition_scope, origin) =
-                            match tcx.hir().find_by_hir_id(opaque_hir_id)
+                            match tcx.hir().find(opaque_hir_id)
                         {
                             Some(Node::Item(item)) => match item.node {
                                 // Anonymous `impl Trait`
index 9e2038fa89ed047efd2ec480d0393f55f9220154..e02ee8943603a6372cc113f9687c0d0b5d75cb1e 100644 (file)
@@ -27,7 +27,7 @@
 // function, then we should explore its block to check for codes that
 // may need to be marked as live.
 fn should_explore<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> bool {
-    match tcx.hir().find_by_hir_id(hir_id) {
+    match tcx.hir().find(hir_id) {
         Some(Node::Item(..)) |
         Some(Node::ImplItem(..)) |
         Some(Node::ForeignItem(..)) |
@@ -145,7 +145,7 @@ fn mark_live_symbols(&mut self) {
             // tuple struct constructor function
             let id = self.struct_constructors.get(&id).cloned().unwrap_or(id);
 
-            if let Some(node) = self.tcx.hir().find_by_hir_id(id) {
+            if let Some(node) = self.tcx.hir().find(id) {
                 self.live_symbols.insert(id);
                 self.visit_node(node);
             }
index 0d59e32b09818fdf5c71d7086100c9d180f80f0b..bea10e914d0383ddbff1ede985472e644cbe231a 100644 (file)
@@ -369,7 +369,7 @@ fn visit_fn<'tcx>(
     // Don't run unused pass for #[derive()]
     if let FnKind::Method(..) = fk {
         let parent = ir.tcx.hir().get_parent_item(id);
-        if let Some(Node::Item(i)) = ir.tcx.hir().find_by_hir_id(parent) {
+        if let Some(Node::Item(i)) = ir.tcx.hir().find(parent) {
             if i.attrs.iter().any(|a| a.check_name(sym::automatically_derived)) {
                 return;
             }
index 593c5e73421685c1248a0d967c592f530f0dc46a..d607c35f8762bb746f1f07f00f83835279a15600 100644 (file)
@@ -53,7 +53,7 @@ fn method_might_be_inlined<'tcx>(
         return true
     }
     if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_src) {
-        match tcx.hir().find_by_hir_id(impl_hir_id) {
+        match tcx.hir().find(impl_hir_id) {
             Some(Node::Item(item)) =>
                 item_might_be_inlined(tcx, &item, codegen_fn_attrs),
             Some(..) | None =>
@@ -147,7 +147,7 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
             None => { return false; }
         };
 
-        match self.tcx.hir().find_by_hir_id(hir_id) {
+        match self.tcx.hir().find(hir_id) {
             Some(Node::Item(item)) => {
                 match item.node {
                     hir::ItemKind::Fn(..) =>
@@ -205,7 +205,7 @@ fn propagate(&mut self) {
                 continue
             }
 
-            if let Some(ref item) = self.tcx.hir().find_by_hir_id(search_item) {
+            if let Some(ref item) = self.tcx.hir().find(search_item) {
                 self.propagate_node(item, search_item);
             }
         }
index ac2124f4a161f895b63b9d80fa1851a1e2b5ae42..412346bab257e6b4b7c25906291ed58fe0d649cc 100644 (file)
@@ -1489,7 +1489,7 @@ fn suggest_eliding_single_use_lifetime(
             }
         };
         if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get(lifetime.hir_id) {
-            if let Some(parent) = self.tcx.hir().find_by_hir_id(
+            if let Some(parent) = self.tcx.hir().find(
                 self.tcx.hir().get_parent_item(hir_lifetime.hir_id))
             {
                 match parent {
index f99d68469765a6991cdce92d08327f5f1fce1857..f54575ff8fc1dcb87047c2bf8482a55537afec47 100644 (file)
@@ -939,7 +939,7 @@ fn suggest_borrow_on_unsized_slice(
     ) {
         if let &ObligationCauseCode::VariableType(hir_id) = code {
             let parent_node = self.tcx.hir().get_parent_node(hir_id);
-            if let Some(Node::Local(ref local)) = self.tcx.hir().find_by_hir_id(parent_node) {
+            if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) {
                 if let Some(ref expr) = local.init {
                     if let hir::ExprKind::Index(_, _) = expr.node {
                         if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
@@ -1014,7 +1014,7 @@ fn suggest_semicolon_removal(
     ) {
         let hir = self.tcx.hir();
         let parent_node = hir.get_parent_node(obligation.cause.body_id);
-        let node = hir.find_by_hir_id(parent_node);
+        let node = hir.find(parent_node);
         if let Some(hir::Node::Item(hir::Item {
             node: hir::ItemKind::Fn(decl, _, _, body_id),
             ..
index 45822fcba7ba4595087f8962932a239f01548fe5..4710d611d99df0a3b2bc63cfa274aeddc443ff59 100644 (file)
@@ -1589,7 +1589,7 @@ pub fn is_suitable_region(&self, region: Region<'tcx>) -> Option<FreeRegionInfo>
         let hir_id = self.hir()
             .as_local_hir_id(suitable_region_binding_scope)
             .unwrap();
-        let is_impl_item = match self.hir().find_by_hir_id(hir_id) {
+        let is_impl_item = match self.hir().find(hir_id) {
             Some(Node::Item(..)) | Some(Node::TraitItem(..)) => false,
             Some(Node::ImplItem(..)) => {
                 self.is_bound_region_in_impl_item(suitable_region_binding_scope)
index 4ff669ddad9ca2427264d03bc24e026f8639697b..3c7f19f7fbf4fb0d772e3462cacde24be6841a5d 100644 (file)
@@ -1022,7 +1022,7 @@ fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
 
                 if let ty::ReScope(scope) = *super_scope {
                     let hir_id = scope.hir_id(&self.region_scope_tree);
-                    match self.tcx.hir().find_by_hir_id(hir_id) {
+                    match self.tcx.hir().find(hir_id) {
                         Some(Node::Stmt(_)) => {
                             if *sub_scope != ty::ReStatic {
                                 db.note("consider using a `let` binding to increase its lifetime");
index ff0e6aacef138061bf1ba87f9d4d84208e9ebce3..87f7f2fdb48b2c0e7f29d333d7e373ea1f2ca7ed 100644 (file)
@@ -908,7 +908,7 @@ fn print_with_analysis<'tcx>(
                 nodeid.expect("`pretty flowgraph=..` needs NodeId (int) or unique path \
                                 suffix (b::c::d)");
             let hir_id = tcx.hir().node_to_hir_id(nodeid);
-            let node = tcx.hir().find_by_hir_id(hir_id).unwrap_or_else(|| {
+            let node = tcx.hir().find(hir_id).unwrap_or_else(|| {
                 tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid))
             });
 
index 1a4b12b03d8317716ed2e453e27545a4f68e7e82..12719c3b9d303bc627101f861ce8c53a79b34e4a 100644 (file)
@@ -405,7 +405,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
                 // reported for missing docs.
                 let real_trait = trait_ref.path.res.def_id();
                 if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(real_trait) {
-                    match cx.tcx.hir().find_by_hir_id(hir_id) {
+                    match cx.tcx.hir().find(hir_id) {
                         Some(Node::Item(item)) => {
                             if let hir::VisibilityKind::Inherited = item.vis.node {
                                 for impl_item_ref in impl_item_refs {
index fc11cd82f8a9aabd7f1e17d41f9d7b6d7cdddb48..92c2e4e01f7608226b84248aad3b57cce985fb43 100644 (file)
@@ -304,7 +304,7 @@ pub(super) fn report_mutability_error(
                 err.span_label(span, format!("cannot {ACT}", ACT = act));
 
                 let upvar_hir_id = self.upvars[upvar_index.index()].var_hir_id;
-                if let Some(Node::Binding(pat)) = self.infcx.tcx.hir().find_by_hir_id(upvar_hir_id)
+                if let Some(Node::Binding(pat)) = self.infcx.tcx.hir().find(upvar_hir_id)
                 {
                     if let hir::PatKind::Binding(
                         hir::BindingAnnotation::Unannotated,
@@ -633,7 +633,7 @@ fn annotate_struct_field(
             let field = def.all_fields().nth(field.index())?;
             // Use the HIR types to construct the diagnostic message.
             let hir_id = tcx.hir().as_local_hir_id(field.did)?;
-            let node = tcx.hir().find_by_hir_id(hir_id)?;
+            let node = tcx.hir().find(hir_id)?;
             // Now we're dealing with the actual struct that we're going to suggest a change to,
             // we can expect a field that is an immutable reference to a type.
             if let hir::Node::Field(field) = node {
index 1cc15ca484eca1b47c7053d8ce98021cd1651e00..311b6aa0c14de263d213649707a13957d5008a39 100644 (file)
@@ -562,7 +562,7 @@ fn construct_fn<'a, 'tcx, A>(
                 by_ref,
             };
             let mut mutability = Mutability::Not;
-            if let Some(Node::Binding(pat)) = tcx_hir.find_by_hir_id(var_hir_id) {
+            if let Some(Node::Binding(pat)) = tcx_hir.find(var_hir_id) {
                 if let hir::PatKind::Binding(_, _, ident, _) = pat.node {
                     debuginfo.debug_name = ident.name;
                     if let Some(&bm) = hir.tables.pat_binding_modes().get(pat.hir_id) {
index 545336a5906bb5918bd93d125ef8c179e67b6372..24df3549be48136c9d8a4e481b0c0364765a75c9 100644 (file)
@@ -577,7 +577,7 @@ fn is_enclosed(
         } else if let Some(Node::Item(&hir::Item {
             node: hir::ItemKind::Fn(_, header, _, _),
             ..
-        })) = tcx.hir().find_by_hir_id(parent_id) {
+        })) = tcx.hir().find(parent_id) {
             match header.unsafety {
                 hir::Unsafety::Unsafe => Some(("fn".to_string(), parent_id)),
                 hir::Unsafety::Normal => None,
index 1c18322259f808fcee21c3304c303bfd28a28a70..ed0a78b46527659bd7aea3eff19f639f50f74681 100644 (file)
@@ -107,7 +107,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr) {
                 };
 
                 if loop_id != hir::DUMMY_HIR_ID {
-                    if let Node::Block(_) = self.hir_map.find_by_hir_id(loop_id).unwrap() {
+                    if let Node::Block(_) = self.hir_map.find(loop_id).unwrap() {
                         return
                     }
                 }
@@ -155,7 +155,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr) {
 
                 match destination.target_id {
                     Ok(loop_id) => {
-                        if let Node::Block(block) = self.hir_map.find_by_hir_id(loop_id).unwrap() {
+                        if let Node::Block(block) = self.hir_map.find(loop_id).unwrap() {
                             struct_span_err!(self.sess, e.span, E0696,
                                             "`continue` pointing to a labeled block")
                                 .span_label(e.span,
index e95911bbec29a719d732536c261e473648e30f56..3e98200e5327466e5d7cdf8ea5988cf4c8785f94 100644 (file)
@@ -1233,7 +1233,7 @@ fn path_is_private_type(&self, path: &hir::Path) -> bool {
         if let Some(hir_id) = self.tcx.hir().as_local_hir_id(did) {
             // .. and it corresponds to a private type in the AST (this returns
             // `None` for type parameters).
-            match self.tcx.hir().find_by_hir_id(hir_id) {
+            match self.tcx.hir().find(hir_id) {
                 Some(Node::Item(ref item)) => !item.vis.node.is_pub(),
                 Some(_) | None => false,
             }
index 3d88b2347c17a3ed02b67e59fd62d8ed82dfd755..19ed9e214073c1618e76294ec9e0ffa424586b95 100644 (file)
@@ -412,7 +412,7 @@ pub fn get_method_data(&self, id: ast::NodeId, ident: ast::Ident, span: Span) ->
                             let mut attrs = vec![];
                             let hir_id = self.tcx.hir().node_to_hir_id(id);
                             if let Some(Node::ImplItem(item)) =
-                                self.tcx.hir().find_by_hir_id(hir_id)
+                                self.tcx.hir().find(hir_id)
                             {
                                 docs = self.docs_for_attrs(&item.attrs);
                                 attrs = item.attrs.to_vec();
@@ -456,7 +456,7 @@ pub fn get_method_data(&self, id: ast::NodeId, ident: ast::Ident, span: Span) ->
                         let mut attrs = vec![];
                         let hir_id = self.tcx.hir().node_to_hir_id(id);
 
-                        if let Some(Node::TraitItem(item)) = self.tcx.hir().find_by_hir_id(hir_id) {
+                        if let Some(Node::TraitItem(item)) = self.tcx.hir().find(hir_id) {
                             docs = self.docs_for_attrs(&item.attrs);
                             attrs = item.attrs.to_vec();
                         }
@@ -526,7 +526,7 @@ pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
         match expr.node {
             ast::ExprKind::Field(ref sub_ex, ident) => {
                 let sub_ex_hir_id = self.tcx.hir().node_to_hir_id(sub_ex.id);
-                let hir_node = match self.tcx.hir().find_by_hir_id(sub_ex_hir_id) {
+                let hir_node = match self.tcx.hir().find(sub_ex_hir_id) {
                     Some(Node::Expr(expr)) => expr,
                     _ => {
                         debug!(
index 180b1eadd68186e432be4717cd77723979d48302..c469d3516e2d48a64b361d15c6249dec908cf177 100644 (file)
@@ -241,12 +241,12 @@ fn can_use_as_ref(
                     hir_id,
                     node: hir::ExprKind::Closure(_, decl, ..),
                     ..
-                })) = self.tcx.hir().find_by_hir_id(parent) {
+                })) = self.tcx.hir().find(parent) {
                     let parent = self.tcx.hir().get_parent_node(*hir_id);
                     if let (Some(Node::Expr(hir::Expr {
                         node: hir::ExprKind::MethodCall(path, span, expr),
                         ..
-                    })), 1) = (self.tcx.hir().find_by_hir_id(parent), decl.inputs.len()) {
+                    })), 1) = (self.tcx.hir().find(parent), decl.inputs.len()) {
                         let self_ty = self.tables.borrow().node_type(expr[0].hir_id);
                         let self_ty = format!("{:?}", self_ty);
                         let name = path.ident.as_str();
@@ -277,7 +277,7 @@ fn can_use_as_ref(
     ) -> bool {
         let cm = self.sess().source_map();
         let parent_id = self.tcx.hir().get_parent_node(hir_id);
-        if let Some(parent) = self.tcx.hir().find_by_hir_id(parent_id) {
+        if let Some(parent) = self.tcx.hir().find(parent_id) {
             // Account for fields
             if let Node::Expr(hir::Expr {
                 node: hir::ExprKind::Struct(_, fields, ..), ..
@@ -421,7 +421,7 @@ pub fn check_ref(
                         if let Some(hir::Node::Expr(hir::Expr {
                             node: hir::ExprKind::Assign(left_expr, _),
                             ..
-                        })) = self.tcx.hir().find_by_hir_id(
+                        })) = self.tcx.hir().find(
                             self.tcx.hir().get_parent_node(expr.hir_id),
                         ) {
                             if mutability == hir::Mutability::MutMutable {
@@ -551,7 +551,7 @@ pub fn check_for_cast(
         if let Some(hir::Node::Expr(hir::Expr {
             node: hir::ExprKind::Struct(_, fields, _),
             ..
-        })) = self.tcx.hir().find_by_hir_id(self.tcx.hir().get_parent_node(expr.hir_id)) {
+        })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id)) {
             // `expr` is a literal field for a struct, only suggest if appropriate
             for field in fields {
                 if field.expr.hir_id == expr.hir_id && field.is_shorthand {
index 8f89a77bd1a3a3423a8c864ce74980d3a77b824a..7e781eeec56a98b3a8a0d887fc632e0948f12755 100644 (file)
@@ -95,7 +95,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx>) {
             // below it'll cause a panic because `def_id` is actually bogus at this
             // point in time otherwise.
             if let Some(id) = tcx.hir().as_local_hir_id(def_id) {
-                if tcx.hir().find_by_hir_id(id).is_none() {
+                if tcx.hir().find(id).is_none() {
                     return false;
                 }
             }
index e392622060c9b9e1fac4de0e59aed5da75800480..42deeaf31f4279d71ee1e85f9abb866876b63961 100644 (file)
@@ -52,7 +52,7 @@ fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) {
     } else {
         // Destructors only work on nominal types.
         if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_did) {
-            if let Some(Node::Item(item)) = tcx.hir().find_by_hir_id(impl_hir_id) {
+            if let Some(Node::Item(item)) = tcx.hir().find(impl_hir_id) {
                 let span = match item.node {
                     ItemKind::Impl(.., ref ty, _) => ty.span,
                     _ => item.span,
index ec0f431d9b25e211d2dcb0059f13624547a7ffe9..3bca41ca7e40d499bad738b88f00b7cf53c09483 100644 (file)
@@ -182,7 +182,7 @@ fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, main_def_id: DefId) {
     let main_t = tcx.type_of(main_def_id);
     match main_t.sty {
         ty::FnDef(..) => {
-            if let Some(Node::Item(it)) = tcx.hir().find_by_hir_id(main_id) {
+            if let Some(Node::Item(it)) = tcx.hir().find(main_id) {
                 if let hir::ItemKind::Fn(.., ref generics, _) = it.node {
                     let mut error = false;
                     if !generics.params.is_empty() {
@@ -247,7 +247,7 @@ fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx>, start_def_id: DefId) {
     let start_t = tcx.type_of(start_def_id);
     match start_t.sty {
         ty::FnDef(..) => {
-            if let Some(Node::Item(it)) = tcx.hir().find_by_hir_id(start_id) {
+            if let Some(Node::Item(it)) = tcx.hir().find(start_id) {
                 if let hir::ItemKind::Fn(.., ref generics, _) = it.node {
                     let mut error = false;
                     if !generics.params.is_empty() {