diff options
-rw-r--r-- | crates/ra_assists/src/assists/early_return.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/early_return.rs b/crates/ra_assists/src/assists/early_return.rs index 7d510b055..3169be2b9 100644 --- a/crates/ra_assists/src/assists/early_return.rs +++ b/crates/ra_assists/src/assists/early_return.rs | |||
@@ -101,7 +101,7 @@ pub(crate) fn convert_to_guarded_return(ctx: AssistCtx) -> Option<Assist> { | |||
101 | // If. | 101 | // If. |
102 | let early_expression = &(early_expression.syntax().to_string() + ";"); | 102 | let early_expression = &(early_expression.syntax().to_string() + ";"); |
103 | let new_expr = if_indent_level | 103 | let new_expr = if_indent_level |
104 | .increase_indent(make::if_expression(&cond_expr, early_expression)); | 104 | .increase_indent(make::if_expression(cond_expr, early_expression)); |
105 | replace(new_expr.syntax(), &then_block, &parent_block, &if_expr) | 105 | replace(new_expr.syntax(), &then_block, &parent_block, &if_expr) |
106 | } | 106 | } |
107 | Some((path, bound_ident)) => { | 107 | Some((path, bound_ident)) => { |
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 629503dc5..02966a3ff 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -158,7 +158,7 @@ pub fn where_clause(preds: impl IntoIterator<Item = ast::WherePred>) -> ast::Whe | |||
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | pub fn if_expression(condition: &ast::Expr, statement: &str) -> ast::IfExpr { | 161 | pub fn if_expression(condition: ast::Expr, statement: &str) -> ast::IfExpr { |
162 | ast_from_text(&format!( | 162 | ast_from_text(&format!( |
163 | "fn f() {{ if !{} {{\n {}\n}}\n}}", | 163 | "fn f() {{ if !{} {{\n {}\n}}\n}}", |
164 | condition.syntax().text(), | 164 | condition.syntax().text(), |