Skip to content

Commit d84d3f8

Browse files
committed
Auto merge of #4030 - phansch:rustup190425, r=Manishearth
Rustup for rust-lang/rust#59042 changelog: none
2 parents 46af9c8 + 1f5a3c6 commit d84d3f8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

clippy_lints/src/loops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1459,12 +1459,12 @@ fn check_for_loop_explicit_counter<'a, 'tcx>(
14591459
// For each candidate, check the parent block to see if
14601460
// it's initialized to zero at the start of the loop.
14611461
let map = &cx.tcx.hir();
1462-
let expr_node_id = map.hir_to_node_id(expr.hir_id);
1462+
let expr_node_id = expr.hir_id;
14631463
let parent_scope = map
14641464
.get_enclosing_scope(expr_node_id)
14651465
.and_then(|id| map.get_enclosing_scope(id));
14661466
if let Some(parent_id) = parent_scope {
1467-
if let Node::Block(block) = map.get(parent_id) {
1467+
if let Node::Block(block) = map.get_by_hir_id(parent_id) {
14681468
for (id, _) in visitor.states.iter().filter(|&(_, v)| *v == VarState::IncrOnce) {
14691469
let mut visitor2 = InitializeVisitor {
14701470
cx,

clippy_lints/src/utils/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,11 @@ pub fn get_parent_expr<'c>(cx: &'c LateContext<'_, '_>, e: &Expr) -> Option<&'c
591591
})
592592
}
593593

594-
pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, node: HirId) -> Option<&'tcx Block> {
594+
pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> {
595595
let map = &cx.tcx.hir();
596-
let node_id = map.hir_to_node_id(node);
597596
let enclosing_node = map
598-
.get_enclosing_scope(node_id)
599-
.and_then(|enclosing_id| map.find(enclosing_id));
597+
.get_enclosing_scope(hir_id)
598+
.and_then(|enclosing_id| map.find_by_hir_id(enclosing_id));
600599
if let Some(node) = enclosing_node {
601600
match node {
602601
Node::Block(block) => Some(block),

0 commit comments

Comments
 (0)