diff options
Diffstat (limited to 'crates/ra_ide_api_light')
-rw-r--r-- | crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs b/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs index d64c34d54..71880b919 100644 --- a/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs +++ b/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs | |||
@@ -11,7 +11,10 @@ pub fn replace_if_let_with_match(ctx: AssistCtx) -> Option<Assist> { | |||
11 | let pat = cond.pat()?; | 11 | let pat = cond.pat()?; |
12 | let expr = cond.expr()?; | 12 | let expr = cond.expr()?; |
13 | let then_block = if_expr.then_branch()?; | 13 | let then_block = if_expr.then_branch()?; |
14 | let else_block = if_expr.else_branch()?; | 14 | let else_block = match if_expr.else_branch()? { |
15 | ast::ElseBranchFlavor::Block(it) => it, | ||
16 | ast::ElseBranchFlavor::IfExpr(_) => return None, | ||
17 | }; | ||
15 | 18 | ||
16 | ctx.build("replace with match", |edit| { | 19 | ctx.build("replace with match", |edit| { |
17 | let match_expr = build_match_expr(expr, pat, then_block, else_block); | 20 | let match_expr = build_match_expr(expr, pat, then_block, else_block); |