mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
apply to only has nested if.
This commit is contained in:
parent
7fee0881db
commit
edb9ad21bd
1 changed files with 5 additions and 1 deletions
|
@ -47,6 +47,10 @@ pub(crate) fn merge_nested_if(acc: &mut Assists, ctx: &AssistContext<'_>) -> Opt
|
|||
|
||||
//check if the then branch is a nested if
|
||||
let then_branch = expr.then_branch()?;
|
||||
let stmt = then_branch.stmt_list()?;
|
||||
if stmt.statements().count() != 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
let nested_if_to_merge = then_branch.syntax().descendants().find_map(ast::IfExpr::cast)?;
|
||||
// should not apply to nested if with else branch.
|
||||
|
|
Loading…
Reference in a new issue