Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/replace_arith_op.rs')
-rw-r--r--crates/ide-assists/src/handlers/replace_arith_op.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ide-assists/src/handlers/replace_arith_op.rs b/crates/ide-assists/src/handlers/replace_arith_op.rs
index b686dc0566..5ad5efac05 100644
--- a/crates/ide-assists/src/handlers/replace_arith_op.rs
+++ b/crates/ide-assists/src/handlers/replace_arith_op.rs
@@ -1,7 +1,7 @@
use ide_db::assists::{AssistId, GroupLabel};
use syntax::{
AstNode,
- ast::{self, ArithOp, BinaryOp, syntax_factory::SyntaxFactory},
+ ast::{self, ArithOp, BinaryOp},
};
use crate::assist_context::{AssistContext, Assists};
@@ -83,8 +83,8 @@ fn replace_arith(acc: &mut Assists, ctx: &AssistContext<'_>, kind: ArithKind) ->
kind.label(),
op_expr.text_range(),
|builder| {
- let mut edit = builder.make_editor(rhs.syntax());
- let make = SyntaxFactory::with_mappings();
+ let editor = builder.make_editor(rhs.syntax());
+ let make = editor.make();
let method_name = kind.method_name(op);
let needs_parentheses =
@@ -92,10 +92,8 @@ fn replace_arith(acc: &mut Assists, ctx: &AssistContext<'_>, kind: ArithKind) ->
let receiver = if needs_parentheses { make.expr_paren(lhs).into() } else { lhs };
let arith_expr =
make.expr_method_call(receiver, make.name_ref(&method_name), make.arg_list([rhs]));
- edit.replace(op_expr, arith_expr.syntax());
-
- edit.add_mappings(make.finish_with_mappings());
- builder.add_file_edits(ctx.vfs_file_id(), edit);
+ editor.replace(op_expr, arith_expr.syntax());
+ builder.add_file_edits(ctx.vfs_file_id(), editor);
},
)
}