diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2019-06-25 14:34:07 -0700 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2019-06-25 14:34:07 -0700 |
| commit | d744dcdaaf1fb73a9cbf660dec8739c3b9f4817a (patch) | |
| tree | 3d6eb1e801f2b1716a00b583e84c9147a18e41b0 | |
| parent | c47a7e4ef2bdbec142e6dd59b65ef58d689f7c7d (diff) | |
| download | rust-d744dcdaaf1fb73a9cbf660dec8739c3b9f4817a.tar.gz rust-d744dcdaaf1fb73a9cbf660dec8739c3b9f4817a.zip | |
find_by_hir_id -> find
| -rw-r--r-- | clippy_lints/src/escape.rs | 6 | ||||
| -rw-r--r-- | clippy_lints/src/eval_order_dependence.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/functions.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/loops.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/needless_pass_by_value.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/non_copy_const.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/ptr.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/trivially_copy_pass_by_ref.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/types.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/utils/mod.rs | 6 |
10 files changed, 17 insertions, 17 deletions
diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index 1c277c10aed..4b87ce7cb9b 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -63,7 +63,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal { ) { // If the method is an impl for a trait, don't warn. let parent_id = cx.tcx.hir().get_parent_item(hir_id); - let parent_node = cx.tcx.hir().find_by_hir_id(parent_id); + let parent_node = cx.tcx.hir().find(parent_id); if let Some(Node::Item(item)) = parent_node { if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node { @@ -115,7 +115,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> { let map = &self.cx.tcx.hir(); if map.is_argument(map.hir_to_node_id(consume_pat.hir_id)) { // Skip closure arguments - if let Some(Node::Expr(..)) = map.find_by_hir_id(map.get_parent_node(consume_pat.hir_id)) { + if let Some(Node::Expr(..)) = map.find(map.get_parent_node(consume_pat.hir_id)) { return; } if is_non_trait_box(cmt.ty) && !self.is_large_box(cmt.ty) { @@ -124,7 +124,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> { return; } if let Categorization::Rvalue(..) = cmt.cat { - if let Some(Node::Stmt(st)) = map.find_by_hir_id(map.get_parent_node(cmt.hir_id)) { + if let Some(Node::Stmt(st)) = map.find(map.get_parent_node(cmt.hir_id)) { if let StmtKind::Local(ref loc) = st.node { if let Some(ref ex) = loc.init { if let ExprKind::Box(..) = ex.node { diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 4a69db65d9d..2db3a2bc00b 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -180,7 +180,7 @@ fn check_for_unsequenced_reads(vis: &mut ReadVisitor<'_, '_>) { if parent_id == cur_id { break; } - let parent_node = match map.find_by_hir_id(parent_id) { + let parent_node = match map.find(parent_id) { Some(parent) => parent, None => break, }; diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index baaee28958c..1c72b60b320 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -110,7 +110,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { let is_impl = if let Some(hir::Node::Item(item)) = cx .tcx .hir() - .find_by_hir_id(cx.tcx.hir().get_parent_node(hir_id)) + .find(cx.tcx.hir().get_parent_node(hir_id)) { matches!(item.node, hir::ItemKind::Impl(_, _, _, _, Some(_), _, _)) } else { diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 7cb87b0bc9a..61bb3e2f823 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -2219,7 +2219,7 @@ fn is_nested(cx: &LateContext<'_, '_>, match_expr: &Expr, iter_expr: &Expr) -> b if_chain! { if let Some(loop_block) = get_enclosing_block(cx, match_expr.hir_id); let parent_node = cx.tcx.hir().get_parent_node(loop_block.hir_id); - if let Some(Node::Expr(loop_expr)) = cx.tcx.hir().find_by_hir_id(parent_node); + if let Some(Node::Expr(loop_expr)) = cx.tcx.hir().find(parent_node); then { return is_loop_nested(cx, loop_expr, iter_expr) } @@ -2239,7 +2239,7 @@ fn is_loop_nested(cx: &LateContext<'_, '_>, loop_expr: &Expr, iter_expr: &Expr) if parent == id { return false; } - match cx.tcx.hir().find_by_hir_id(parent) { + match cx.tcx.hir().find(parent) { Some(Node::Expr(expr)) => match expr.node { ExprKind::Loop(..) | ExprKind::While(..) => { return true; diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 1413f16df1e..1409e9725c3 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -91,7 +91,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { if let Some(Node::Item(item)) = cx .tcx .hir() - .find_by_hir_id(cx.tcx.hir().get_parent_node(hir_id)) + .find(cx.tcx.hir().get_parent_node(hir_id)) { if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) | ItemKind::Trait(..)) @@ -364,7 +364,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> { } id = parent; - if let Some(node) = self.cx.tcx.hir().find_by_hir_id(id) { + if let Some(node) = self.cx.tcx.hir().find(id) { match node { Node::Expr(e) => { // `match` and `if let` diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index ba7fef25809..62e4f692ef8 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -208,7 +208,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst { if parent_id == cur_expr.hir_id { break; } - if let Some(Node::Expr(parent_expr)) = cx.tcx.hir().find_by_hir_id(parent_id) { + if let Some(Node::Expr(parent_expr)) = cx.tcx.hir().find(parent_id) { match &parent_expr.node { ExprKind::AddrOf(..) => { // `&e` => `e` must be referenced. diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index af69d62ddb7..ff49ee95208 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -106,7 +106,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr { fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) { if let ImplItemKind::Method(ref sig, body_id) = item.node { let parent_item = cx.tcx.hir().get_parent_item(item.hir_id); - if let Some(Node::Item(it)) = cx.tcx.hir().find_by_hir_id(parent_item) { + if let Some(Node::Item(it)) = cx.tcx.hir().find(parent_item) { if let ItemKind::Impl(_, _, _, _, Some(_), _, _) = it.node { return; // ignore trait impls } diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index f9fbb8a871d..b3a3b0a658b 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -182,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef { if let Some(Node::Item(item)) = cx .tcx .hir() - .find_by_hir_id(cx.tcx.hir().get_parent_node(hir_id)) + .find(cx.tcx.hir().get_parent_node(hir_id)) { if matches!(item.node, ItemKind::Impl(_, _, _, _, Some(_), _, _) | ItemKind::Trait(..)) diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index b79d088b7aa..36a4b699fb6 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -168,7 +168,7 @@ declare_lint_pass!(Types => [BOX_VEC, VEC_BOX, OPTION_OPTION, LINKEDLIST, BORROW impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Types { fn check_fn(&mut self, cx: &LateContext<'_, '_>, _: FnKind<'_>, decl: &FnDecl, _: &Body, _: Span, id: HirId) { // Skip trait implementations; see issue #605. - if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_hir_id(cx.tcx.hir().get_parent_item(id)) { + if let Some(hir::Node::Item(item)) = cx.tcx.hir().find(cx.tcx.hir().get_parent_item(id)) { if let ItemKind::Impl(_, _, _, _, Some(..), _, _) = item.node { return; } @@ -585,7 +585,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitArg { } if_chain! { let map = &cx.tcx.hir(); - let opt_parent_node = map.find_by_hir_id(map.get_parent_node(expr.hir_id)); + let opt_parent_node = map.find(map.get_parent_node(expr.hir_id)); if let Some(hir::Node::Expr(parent_expr)) = opt_parent_node; if is_questionmark_desugar_marked_call(parent_expr); then { diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index e5569647ff0..4647058ddfb 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -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), |
