aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/assist_context.rs14
-rw-r--r--crates/ra_ide_db/src/source_change.rs2
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs
index 3640bb4d2..c33525363 100644
--- a/crates/ra_assists/src/assist_context.rs
+++ b/crates/ra_assists/src/assist_context.rs
@@ -176,7 +176,7 @@ pub(crate) struct AssistBuilder {
176 edit: TextEditBuilder, 176 edit: TextEditBuilder,
177 file_id: FileId, 177 file_id: FileId,
178 is_snippet: bool, 178 is_snippet: bool,
179 edits: Vec<SourceFileEdit>, 179 change: SourceChange,
180} 180}
181 181
182impl AssistBuilder { 182impl AssistBuilder {
@@ -185,7 +185,7 @@ impl AssistBuilder {
185 edit: TextEditBuilder::default(), 185 edit: TextEditBuilder::default(),
186 file_id, 186 file_id,
187 is_snippet: false, 187 is_snippet: false,
188 edits: Vec::new(), 188 change: SourceChange::default(),
189 } 189 }
190 } 190 }
191 191
@@ -197,8 +197,8 @@ impl AssistBuilder {
197 let edit = mem::take(&mut self.edit).finish(); 197 let edit = mem::take(&mut self.edit).finish();
198 if !edit.is_empty() { 198 if !edit.is_empty() {
199 let new_edit = SourceFileEdit { file_id: self.file_id, edit }; 199 let new_edit = SourceFileEdit { file_id: self.file_id, edit };
200 assert!(!self.edits.iter().any(|it| it.file_id == new_edit.file_id)); 200 assert!(!self.change.source_file_edits.iter().any(|it| it.file_id == new_edit.file_id));
201 self.edits.push(new_edit); 201 self.change.source_file_edits.push(new_edit);
202 } 202 }
203 } 203 }
204 204
@@ -265,10 +265,10 @@ impl AssistBuilder {
265 265
266 fn finish(mut self) -> SourceChange { 266 fn finish(mut self) -> SourceChange {
267 self.commit(); 267 self.commit();
268 let mut res: SourceChange = mem::take(&mut self.edits).into(); 268 let mut change = mem::take(&mut self.change);
269 if self.is_snippet { 269 if self.is_snippet {
270 res.is_snippet = true; 270 change.is_snippet = true;
271 } 271 }
272 res 272 change
273 } 273 }
274} 274}
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs
index 0bbd3c3e5..abb83f421 100644
--- a/crates/ra_ide_db/src/source_change.rs
+++ b/crates/ra_ide_db/src/source_change.rs
@@ -6,7 +6,7 @@
6use ra_db::FileId; 6use ra_db::FileId;
7use ra_text_edit::TextEdit; 7use ra_text_edit::TextEdit;
8 8
9#[derive(Debug, Clone)] 9#[derive(Default, Debug, Clone)]
10pub struct SourceChange { 10pub struct SourceChange {
11 pub source_file_edits: Vec<SourceFileEdit>, 11 pub source_file_edits: Vec<SourceFileEdit>,
12 pub file_system_edits: Vec<FileSystemEdit>, 12 pub file_system_edits: Vec<FileSystemEdit>,