1
Fork 0

fix: Add if to check whether the previous node is Block

This commit is contained in:
cardigan1008 2024-05-09 14:36:54 +08:00
parent 5ce96b1d0f
commit c54301f114

View file

@ -563,6 +563,9 @@ impl<'hir> Map<'hir> {
// We verify that indirectly by checking that the previous node is the
// current node's body
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)
}
// Ignore `return`s on the first iteration