about summary refs log tree commit diff
path: root/clippy_lints/src/utils/internal_lints
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-02-09 23:58:36 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-02-10 12:24:46 +0300
commitfc8f6628ab945fc1b8586d6a83d78f247eaf512c (patch)
tree574ebb628d6666725821dc377260292178de03c9 /clippy_lints/src/utils/internal_lints
parent8f00ffc901badd27e7d58641daecb30b8cd76a74 (diff)
hir: Remove `hir::Map::{opt_parent_id,parent_id,get_parent,find_parent}`
Diffstat (limited to 'clippy_lints/src/utils/internal_lints')
-rw-r--r--clippy_lints/src/utils/internal_lints/metadata_collector.rs6
-rw-r--r--clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs3
2 files changed, 4 insertions, 5 deletions
diff --git a/clippy_lints/src/utils/internal_lints/metadata_collector.rs b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
index fae1b90ace2..349e0e3e077 100644
--- a/clippy_lints/src/utils/internal_lints/metadata_collector.rs
+++ b/clippy_lints/src/utils/internal_lints/metadata_collector.rs
@@ -1007,9 +1007,9 @@ fn get_parent_local<'hir>(cx: &LateContext<'hir>, expr: &'hir hir::Expr<'hir>) -
 fn get_parent_local_hir_id<'hir>(cx: &LateContext<'hir>, hir_id: hir::HirId) -> Option<&'hir hir::Local<'hir>> {
     let map = cx.tcx.hir();
 
-    match map.find_parent(hir_id) {
-        Some(hir::Node::Local(local)) => Some(local),
-        Some(hir::Node::Pat(pattern)) => get_parent_local_hir_id(cx, pattern.hir_id),
+    match cx.tcx.parent_hir_node(hir_id) {
+        hir::Node::Local(local) => Some(local),
+        hir::Node::Pat(pattern) => get_parent_local_hir_id(cx, pattern.hir_id),
         _ => None,
     }
 }
diff --git a/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs b/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs
index 6e449dc9806..38c832931fc 100644
--- a/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs
+++ b/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs
@@ -217,8 +217,7 @@ fn path_to_matched_type(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<Ve
     match peel_hir_expr_refs(expr).0.kind {
         ExprKind::Path(ref qpath) => match cx.qpath_res(qpath, expr.hir_id) {
             Res::Local(hir_id) => {
-                let parent_id = cx.tcx.hir().parent_id(hir_id);
-                if let Node::Local(Local { init: Some(init), .. }) = cx.tcx.hir_node(parent_id) {
+                if let Node::Local(Local { init: Some(init), .. }) = cx.tcx.parent_hir_node(hir_id) {
                     path_to_matched_type(cx, init)
                 } else {
                     None