about summary refs log tree commit diff
path: root/clippy_lints/src/utils
diff options
context:
space:
mode:
authorzetanumbers <dariasukhonina@gmail.com>2023-12-01 05:28:34 -0800
committerzetanumbers <dariasukhonina@gmail.com>2023-12-12 06:40:29 -0800
commitfe37cc1d9783b5332dbbd22676c9702a818085ea (patch)
treef66bb6067c83a2a49fe6928a866ed811791855f6 /clippy_lints/src/utils
parentc8213a49bb4508c95f29cd5689737c65ac786862 (diff)
downloadrust-fe37cc1d9783b5332dbbd22676c9702a818085ea.tar.gz
rust-fe37cc1d9783b5332dbbd22676c9702a818085ea.zip
Move some methods from `tcx.hir()` to `tcx`
Renamings:
- find -> opt_hir_node
- get -> hir_node
- find_by_def_id -> opt_hir_node_by_def_id
- get_by_def_id -> hir_node_by_def_id

Fix rebase changes using removed methods

Use `tcx.hir_node_by_def_id()` whenever possible in compiler

Fix clippy errors

Fix compiler

Apply suggestions from code review

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>

Add FIXME for `tcx.hir()` returned type about its removal

Simplify with with `tcx.hir_node_by_def_id`
Diffstat (limited to 'clippy_lints/src/utils')
-rw-r--r--clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs2
1 files changed, 1 insertions, 1 deletions
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 70ca1b206b4..31a81a52497 100644
--- a/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs
+++ b/clippy_lints/src/utils/internal_lints/unnecessary_def_path.rs
@@ -218,7 +218,7 @@ fn path_to_matched_type(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<Ve
         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 Some(Node::Local(Local { init: Some(init), .. })) = cx.tcx.hir().find(parent_id) {
+                if let Some(Node::Local(Local { init: Some(init), .. })) = cx.tcx.hir_node(parent_id) {
                     path_to_matched_type(cx, init)
                 } else {
                     None