aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/reorder_fields.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-09 11:40:08 +0000
committerGitHub <[email protected]>2020-11-09 11:40:08 +0000
commit2f247140817c9cbd9009085c9f9ccedb4f6a718f (patch)
tree9866d241ed3345fd89ac511eba4bd3d85bd41171 /crates/assists/src/handlers/reorder_fields.rs
parenta12088456072459c7df2d9d8f077a69ab518710a (diff)
parent4c03d98db4638729e8b47449ba76bf51e33cd444 (diff)
Merge #6501
6501: Remove text_edit_builder api from AssistBuilder r=matklad a=Veykril Also fixes a small bug in `expand_glob_import` in regards to the very nice looking `something::{*}` import when only one item was used. Before it would duplicate the path and just append it, causing the following wrong import `something::something::UsedItem`. Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/reorder_fields.rs')
-rw-r--r--crates/assists/src/handlers/reorder_fields.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/assists/src/handlers/reorder_fields.rs b/crates/assists/src/handlers/reorder_fields.rs
index 527f457a7..7c0f0f44e 100644
--- a/crates/assists/src/handlers/reorder_fields.rs
+++ b/crates/assists/src/handlers/reorder_fields.rs
@@ -47,9 +47,11 @@ fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
47 "Reorder record fields", 47 "Reorder record fields",
48 target, 48 target,
49 |edit| { 49 |edit| {
50 let mut rewriter = algo::SyntaxRewriter::default();
50 for (old, new) in fields.iter().zip(&sorted_fields) { 51 for (old, new) in fields.iter().zip(&sorted_fields) {
51 algo::diff(old, new).into_text_edit(edit.text_edit_builder()); 52 rewriter.replace(old, new);
52 } 53 }
54 edit.rewrite(rewriter);
53 }, 55 },
54 ) 56 )
55} 57}