aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api_light/src/assists
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-26 21:23:07 +0000
committerAleksey Kladov <[email protected]>2019-01-26 21:37:11 +0000
commit619af1e22cb71b981fde4cedbf6ebce9b3488028 (patch)
treeb99f89f6e652e7f34519ef5f4f8bfeb71694f40d /crates/ra_ide_api_light/src/assists
parent2d337c88b07b6a67b24f4bff4d72025d9ea412a5 (diff)
fix AST for if expressions
then is not always a block...
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.rs5
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);