diff options
author | Aleksey Kladov <[email protected]> | 2019-09-30 08:05:12 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-30 08:05:12 +0100 |
commit | 05ca252fb51bbbf60433bdd3af55ce14bbd66bfd (patch) | |
tree | 3f1b50838de801f487c811df3c9a7e7b0c229ba7 /crates/ra_assists/src/assists | |
parent | 054c53aeb9a9e29d1c06fa183da263037aa62572 (diff) |
remove ast_editor.rs
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/move_bounds.rs | 9 |
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 @@ | |||
1 | use hir::db::HirDatabase; | 1 | use hir::db::HirDatabase; |
2 | use ra_syntax::{ | 2 | use 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 | ||
8 | use crate::{ast_editor::AstEditor, Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
9 | 9 | ||
10 | pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 10 | pub(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); |