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:
commit
ba1bb80b6b
3 changed files with 18 additions and 0 deletions
|
@ -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,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue