diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-05-23 00:23:40 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-05-23 00:23:40 +0100 |
commit | fce10200a0d666fbd2e2faa84b0526f586485bb3 (patch) | |
tree | c9d8b8e7056005bcb512146bf6e817a916952611 /crates/ra_assists/src/assist_context.rs | |
parent | ef1aaeb59516b16f1b83eb7cdb22f1bcdcc46446 (diff) |
Better naming and fix some review comments
Diffstat (limited to 'crates/ra_assists/src/assist_context.rs')
-rw-r--r-- | crates/ra_assists/src/assist_context.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index e7220eea9..94286b497 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -292,13 +292,12 @@ impl AssistBuilder { | |||
292 | } | 292 | } |
293 | 293 | ||
294 | pub(crate) struct AssistDirector { | 294 | pub(crate) struct AssistDirector { |
295 | source_changes: Vec<SourceChange>, | ||
296 | builders: FxHashMap<FileId, AssistBuilder>, | 295 | builders: FxHashMap<FileId, AssistBuilder>, |
297 | } | 296 | } |
298 | 297 | ||
299 | impl AssistDirector { | 298 | impl AssistDirector { |
300 | fn new() -> AssistDirector { | 299 | fn new() -> AssistDirector { |
301 | AssistDirector { source_changes: vec![], builders: FxHashMap::default() } | 300 | AssistDirector { builders: FxHashMap::default() } |
302 | } | 301 | } |
303 | 302 | ||
304 | pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { | 303 | pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { |
@@ -306,10 +305,10 @@ impl AssistDirector { | |||
306 | f(&mut builder); | 305 | f(&mut builder); |
307 | } | 306 | } |
308 | 307 | ||
309 | fn finish(mut self) -> Vec<SourceChange> { | 308 | fn finish(self) -> Vec<SourceChange> { |
310 | for (_, builder) in self.builders.into_iter().collect::<Vec<(FileId, AssistBuilder)>>() { | 309 | self.builders |
311 | self.source_changes.push(builder.finish()); | 310 | .into_iter() |
312 | } | 311 | .map(|(_, builder)| builder.finish()) |
313 | self.source_changes | 312 | .collect::<Vec<SourceChange>>() |
314 | } | 313 | } |
315 | } | 314 | } |