aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r--crates/ra_assists/src/assists/move_bounds.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assists/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs
index 1d27832a3..39ff51233 100644
--- a/crates/ra_assists/src/assists/move_bounds.rs
+++ b/crates/ra_assists/src/assists/move_bounds.rs
@@ -1,11 +1,11 @@
1use hir::db::HirDatabase; 1use hir::db::HirDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{self, make, AstNode, NameOwner, TypeBoundsOwner}, 3 ast::{self, edit, make, AstNode, NameOwner, TypeBoundsOwner},
4 SyntaxElement, 4 SyntaxElement,
5 SyntaxKind::*, 5 SyntaxKind::*,
6}; 6};
7 7
8use crate::{ast_editor::AstEditor, Assist, AssistCtx, AssistId}; 8use crate::{Assist, AssistCtx, AssistId};
9 9
10pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let type_param_list = ctx.node_at_offset::<ast::TypeParamList>()?; 11 let type_param_list = ctx.node_at_offset::<ast::TypeParamList>()?;
@@ -43,9 +43,8 @@ pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>)
43 (type_param, without_bounds) 43 (type_param, without_bounds)
44 }); 44 });
45 45
46 let mut ast_editor = AstEditor::new(type_param_list.clone()); 46 let new_type_param_list = edit::replace_descendants(&type_param_list, new_params);
47 ast_editor.replace_descendants(new_params); 47 edit.replace_ast(type_param_list.clone(), new_type_param_list);
48 ast_editor.into_text_edit(edit.text_edit_builder());
49 48
50 let where_clause = { 49 let where_clause = {
51 let predicates = type_param_list.type_params().filter_map(build_predicate); 50 let predicates = type_param_list.type_params().filter_map(build_predicate);