fix: Add if to check whether the previous node is Block
This commit is contained in:
parent
5ce96b1d0f
commit
c54301f114
1 changed files with 3 additions and 0 deletions
|
@ -563,6 +563,9 @@ impl<'hir> Map<'hir> {
|
||||||
// We verify that indirectly by checking that the previous node is the
|
// We verify that indirectly by checking that the previous node is the
|
||||||
// current node's body
|
// current node's body
|
||||||
if node.body_id().map(|b| b.hir_id) == prev_hir_id => {
|
if node.body_id().map(|b| b.hir_id) == prev_hir_id => {
|
||||||
|
if let Node::Expr(Expr { kind: ExprKind::Block(_, _), ..}) = self.tcx.hir_node(prev_hir_id.unwrap()) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
return Some(hir_id)
|
return Some(hir_id)
|
||||||
}
|
}
|
||||||
// Ignore `return`s on the first iteration
|
// Ignore `return`s on the first iteration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue