find_by_hir_id -> find

This commit is contained in:
Manish Goregaokar
2019-06-25 14:34:07 -07:00
parent c47a7e4ef2
commit d744dcdaaf
10 changed files with 17 additions and 17 deletions

View File

@@ -404,7 +404,7 @@ pub fn is_entrypoint_fn(cx: &LateContext<'_, '_>, def_id: DefId) -> bool {
/// Gets the name of the item the expression is in, if available.
pub fn get_item_name(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<Name> {
let parent_id = cx.tcx.hir().get_parent_item(expr.hir_id);
match cx.tcx.hir().find_by_hir_id(parent_id) {
match cx.tcx.hir().find(parent_id) {
Some(Node::Item(&Item { ref ident, .. })) => Some(ident.name),
Some(Node::TraitItem(&TraitItem { ident, .. })) | Some(Node::ImplItem(&ImplItem { ident, .. })) => {
Some(ident.name)
@@ -596,7 +596,7 @@ pub fn get_parent_expr<'c>(cx: &'c LateContext<'_, '_>, e: &Expr) -> Option<&'c
if hir_id == parent_id {
return None;
}
map.find_by_hir_id(parent_id).and_then(|node| {
map.find(parent_id).and_then(|node| {
if let Node::Expr(parent) = node {
Some(parent)
} else {
@@ -609,7 +609,7 @@ pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId)
let map = &cx.tcx.hir();
let enclosing_node = map
.get_enclosing_scope(hir_id)
.and_then(|enclosing_id| map.find_by_hir_id(enclosing_id));
.and_then(|enclosing_id| map.find(enclosing_id));
if let Some(node) = enclosing_node {
match node {
Node::Block(block) => Some(block),