diff options
author | krk <[email protected]> | 2019-11-01 15:58:09 +0000 |
---|---|---|
committer | krk <[email protected]> | 2019-11-01 15:58:09 +0000 |
commit | 1841a39f865b38041e84cd80840587dbe57d62c1 (patch) | |
tree | 75a7209c2f02bebd1c93efde21e7ac2272f2f739 /crates/ra_assists/src | |
parent | 4a4d9f7a90dc0605992c4f774a8d9a1323ad6d1e (diff) |
Remove variable pat.
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/assists/early_return.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs index 827170f8f..4322d3737 100644 --- a/crates/ra_assists/src/assists/early_return.rs +++ b/crates/ra_assists/src/assists/early_return.rs | |||
@@ -38,7 +38,6 @@ use crate::{ | |||
38 | pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 38 | pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
39 | let if_expr: ast::IfExpr = ctx.find_node_at_offset()?; | 39 | let if_expr: ast::IfExpr = ctx.find_node_at_offset()?; |
40 | let cond = if_expr.condition()?; | 40 | let cond = if_expr.condition()?; |
41 | let pat = &cond.pat(); | ||
42 | let expr = cond.expr()?; | 41 | let expr = cond.expr()?; |
43 | let then_block = if_expr.then_branch()?.block()?; | 42 | let then_block = if_expr.then_branch()?.block()?; |
44 | if if_expr.else_branch().is_some() { | 43 | if if_expr.else_branch().is_some() { |
@@ -79,7 +78,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx<impl HirDatabase>) -> Opt | |||
79 | 78 | ||
80 | ctx.add_assist(AssistId("convert_to_guarded_return"), "convert to guarded return", |edit| { | 79 | ctx.add_assist(AssistId("convert_to_guarded_return"), "convert to guarded return", |edit| { |
81 | let if_indent_level = IndentLevel::from_node(&if_expr.syntax()); | 80 | let if_indent_level = IndentLevel::from_node(&if_expr.syntax()); |
82 | let new_block = match pat { | 81 | let new_block = match cond.pat() { |
83 | None => { | 82 | None => { |
84 | // If. | 83 | // If. |
85 | let early_expression = &(early_expression.to_owned() + ";"); | 84 | let early_expression = &(early_expression.to_owned() + ";"); |