Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/convert_bool_then.rs')
-rw-r--r--crates/ide-assists/src/handlers/convert_bool_then.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/ide-assists/src/handlers/convert_bool_then.rs b/crates/ide-assists/src/handlers/convert_bool_then.rs
index b3bfe5b8c4..c36c79ee99 100644
--- a/crates/ide-assists/src/handlers/convert_bool_then.rs
+++ b/crates/ide-assists/src/handlers/convert_bool_then.rs
@@ -77,8 +77,7 @@ pub(crate) fn convert_if_to_bool_then(acc: &mut Assists, ctx: &AssistContext<'_>
"Convert `if` expression to `bool::then` call",
target,
|builder| {
- let closure_body = closure_body.clone_subtree();
- let mut editor = SyntaxEditor::new(closure_body.syntax().clone());
+ let (mut editor, closure_body) = SyntaxEditor::with_ast_node(&closure_body);
// Rewrite all `Some(e)` in tail position to `e`
for_each_tail_expr(&closure_body, &mut |e| {
let e = match e {
@@ -188,8 +187,7 @@ pub(crate) fn convert_bool_then_to_if(acc: &mut Assists, ctx: &AssistContext<'_>
e => mapless_make.block_expr(None, Some(e)),
};
- let closure_body = closure_body.clone_subtree();
- let mut editor = SyntaxEditor::new(closure_body.syntax().clone());
+ let (mut editor, closure_body) = SyntaxEditor::with_ast_node(&closure_body);
// Wrap all tails in `Some(...)`
let none_path = mapless_make.expr_path(mapless_make.ident_path("None"));
let some_path = mapless_make.expr_path(mapless_make.ident_path("Some"));