aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_assists/src/assist_context.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs
index 52bc7820e..37de4f590 100644
--- a/crates/ra_assists/src/assist_context.rs
+++ b/crates/ra_assists/src/assist_context.rs
@@ -178,11 +178,10 @@ impl Assists {
178 label: Assist, 178 label: Assist,
179 f: impl FnOnce(&mut AssistDirector), 179 f: impl FnOnce(&mut AssistDirector),
180 ) -> Option<()> { 180 ) -> Option<()> {
181 let change_label = label.label.clone();
182 if !self.resolve { 181 if !self.resolve {
183 return None; 182 return None;
184 } 183 }
185 let mut director = AssistDirector::new(change_label.clone()); 184 let mut director = AssistDirector::new();
186 f(&mut director); 185 f(&mut director);
187 let changes = director.finish(); 186 let changes = director.finish();
188 let file_edits: Vec<SourceFileEdit> = 187 let file_edits: Vec<SourceFileEdit> =
@@ -295,12 +294,11 @@ impl AssistBuilder {
295pub(crate) struct AssistDirector { 294pub(crate) struct AssistDirector {
296 source_changes: Vec<SourceChange>, 295 source_changes: Vec<SourceChange>,
297 builders: FxHashMap<FileId, AssistBuilder>, 296 builders: FxHashMap<FileId, AssistBuilder>,
298 change_label: String,
299} 297}
300 298
301impl AssistDirector { 299impl AssistDirector {
302 fn new(change_label: String) -> AssistDirector { 300 fn new() -> AssistDirector {
303 AssistDirector { source_changes: vec![], builders: FxHashMap::default(), change_label } 301 AssistDirector { source_changes: vec![], builders: FxHashMap::default() }
304 } 302 }
305 303
306 pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { 304 pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) {
@@ -309,7 +307,7 @@ impl AssistDirector {
309 } 307 }
310 308
311 fn finish(mut self) -> Vec<SourceChange> { 309 fn finish(mut self) -> Vec<SourceChange> {
312 for (file_id, builder) in 310 for (_, builder) in
313 self.builders.into_iter().collect::<Vec<(FileId, AssistBuilder)>>() 311 self.builders.into_iter().collect::<Vec<(FileId, AssistBuilder)>>()
314 { 312 {
315 self.source_changes.push(builder.finish()); 313 self.source_changes.push(builder.finish());