From 1f5a3c6e5221a4e830106cfc9eae3a3efedec63b Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Thu, 25 Apr 2019 07:29:23 +0200 Subject: [PATCH] Rustup for https://github.com/rust-lang/rust/pull/59042 --- clippy_lints/src/loops.rs | 4 ++-- clippy_lints/src/utils/mod.rs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index a38ce24d11ce..5fb1a988d148 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1459,12 +1459,12 @@ fn check_for_loop_explicit_counter<'a, 'tcx>( // For each candidate, check the parent block to see if // it's initialized to zero at the start of the loop. let map = &cx.tcx.hir(); - let expr_node_id = map.hir_to_node_id(expr.hir_id); + let expr_node_id = expr.hir_id; let parent_scope = map .get_enclosing_scope(expr_node_id) .and_then(|id| map.get_enclosing_scope(id)); if let Some(parent_id) = parent_scope { - if let Node::Block(block) = map.get(parent_id) { + if let Node::Block(block) = map.get_by_hir_id(parent_id) { for (id, _) in visitor.states.iter().filter(|&(_, v)| *v == VarState::IncrOnce) { let mut visitor2 = InitializeVisitor { cx, diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index e95acd343bf4..868c8b906ad5 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -591,12 +591,11 @@ pub fn get_parent_expr<'c>(cx: &'c LateContext<'_, '_>, e: &Expr) -> Option<&'c }) } -pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, node: HirId) -> Option<&'tcx Block> { +pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> { let map = &cx.tcx.hir(); - let node_id = map.hir_to_node_id(node); let enclosing_node = map - .get_enclosing_scope(node_id) - .and_then(|enclosing_id| map.find(enclosing_id)); + .get_enclosing_scope(hir_id) + .and_then(|enclosing_id| map.find_by_hir_id(enclosing_id)); if let Some(node) = enclosing_node { match node { Node::Block(block) => Some(block),