diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-26 21:41:27 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-26 21:41:27 +0000 |
commit | e40d8d40321b191ee82b8b07910f8a0898c8914c (patch) | |
tree | 7adcdf5fd1a09bdb18776e210a4686342979cbe6 /crates/ra_ide_api_light/src/assists | |
parent | 99b032b0f6b3f718ee9500655f1149dc33eac610 (diff) | |
parent | 619af1e22cb71b981fde4cedbf6ebce9b3488028 (diff) |
Merge #683
683: fix AST for if expressions r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api_light/src/assists')
-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); |