1
Fork 0

Rollup merge of #124917 - cardigan1008:issue-124819, r=pnkfelix

Check whether the next_node is else-less if in get_return_block

Fix #124819
This commit is contained in:
Matthias Krüger 2024-05-20 18:13:47 +02:00 committed by GitHub
commit ba1bb80b6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View file

@ -549,6 +549,7 @@ impl<'hir> Map<'hir> {
Node::Block(Block { expr: None, .. }) => return None,
// The current node is not the tail expression of its parent.
Node::Block(Block { expr: Some(e), .. }) if hir_id != e.hir_id => return None,
Node::Block(Block { expr: Some(e), ..}) if matches!(e.kind, ExprKind::If(_, _, None)) => return None,
_ => {}
}
}