Skip to content

Commit 6aea41e

Browse files
committed
Fix fallout cause NodeId pruning
1 parent 9cae8aa commit 6aea41e

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

clippy_lints/src/loops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
16471647
then {
16481648
let res = cx.tables.qpath_res(qpath, bound.hir_id);
16491649
if let Res::Local(node_id) = res {
1650-
let node_str = cx.tcx.hir().get_by_hir_id(node_id);
1650+
let node_str = cx.tcx.hir().get(node_id);
16511651
if_chain! {
16521652
if let Node::Binding(pat) = node_str;
16531653
if let PatKind::Binding(bind_ann, ..) = pat.node;

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp
14241424
snip = Some(("try removing the `clone` call", format!("{}", snippet)));
14251425
} else {
14261426
let parent = cx.tcx.hir().get_parent_node_by_hir_id(expr.hir_id);
1427-
match cx.tcx.hir().get_by_hir_id(parent) {
1427+
match cx.tcx.hir().get(parent) {
14281428
hir::Node::Expr(parent) => match parent.node {
14291429
// &*x is a nop, &x.clone() is not
14301430
hir::ExprKind::AddrOf(..) |

clippy_lints/src/needless_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool {
116116

117117
fn parent_node_is_if_expr<'a, 'b>(expr: &Expr, cx: &LateContext<'a, 'b>) -> bool {
118118
let parent_id = cx.tcx.hir().get_parent_node_by_hir_id(expr.hir_id);
119-
let parent_node = cx.tcx.hir().get_by_hir_id(parent_id);
119+
let parent_node = cx.tcx.hir().get(parent_id);
120120

121121
if let rustc::hir::Node::Expr(e) = parent_node {
122122
if higher::if_block(&e).is_some() {

clippy_lints/src/suspicious_trait_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SuspiciousImpl {
6767
// as a child node
6868
let mut parent_expr = cx.tcx.hir().get_parent_node_by_hir_id(expr.hir_id);
6969
while parent_expr != hir::CRATE_HIR_ID {
70-
if let hir::Node::Expr(e) = cx.tcx.hir().get_by_hir_id(parent_expr) {
70+
if let hir::Node::Expr(e) = cx.tcx.hir().get(parent_expr) {
7171
match e.node {
7272
hir::ExprKind::Binary(..)
7373
| hir::ExprKind::Unary(hir::UnOp::UnNot, _)

clippy_lints/src/utils/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn differing_macro_contexts(lhs: Span, rhs: Span) -> bool {
6666
/// ```
6767
pub fn in_constant(cx: &LateContext<'_, '_>, id: HirId) -> bool {
6868
let parent_id = cx.tcx.hir().get_parent_item(id);
69-
match cx.tcx.hir().get_by_hir_id(parent_id) {
69+
match cx.tcx.hir().get(parent_id) {
7070
Node::Item(&Item {
7171
node: ItemKind::Const(..),
7272
..
@@ -320,7 +320,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'_, 'tcx>, hir_id: HirId) -> O
320320
let parent_impl = cx.tcx.hir().get_parent_item(hir_id);
321321
if_chain! {
322322
if parent_impl != hir::CRATE_HIR_ID;
323-
if let hir::Node::Item(item) = cx.tcx.hir().get_by_hir_id(parent_impl);
323+
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
324324
if let hir::ItemKind::Impl(_, _, _, _, trait_ref, _, _) = &item.node;
325325
then { return trait_ref.as_ref(); }
326326
}

0 commit comments

Comments
 (0)