diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-05-23 00:27:11 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-05-23 00:27:11 +0100 |
commit | 4984520ef565e926ba08c6512715ed631e4527e4 (patch) | |
tree | d0748a2e7c4b233c934df30ca5c36f08c6610832 /crates/ra_assists/src | |
parent | fce10200a0d666fbd2e2faa84b0526f586485bb3 (diff) |
Use default instead of new in AssistDirector
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/assist_context.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 94286b497..bc5481494 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -181,7 +181,7 @@ impl Assists { | |||
181 | if !self.resolve { | 181 | if !self.resolve { |
182 | return None; | 182 | return None; |
183 | } | 183 | } |
184 | let mut director = AssistDirector::new(); | 184 | let mut director = AssistDirector::default(); |
185 | f(&mut director); | 185 | f(&mut director); |
186 | let changes = director.finish(); | 186 | let changes = director.finish(); |
187 | let file_edits: Vec<SourceFileEdit> = | 187 | let file_edits: Vec<SourceFileEdit> = |
@@ -296,10 +296,6 @@ pub(crate) struct AssistDirector { | |||
296 | } | 296 | } |
297 | 297 | ||
298 | impl AssistDirector { | 298 | impl AssistDirector { |
299 | fn new() -> AssistDirector { | ||
300 | AssistDirector { builders: FxHashMap::default() } | ||
301 | } | ||
302 | |||
303 | pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { | 299 | pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { |
304 | let mut builder = self.builders.entry(file_id).or_insert(AssistBuilder::new(file_id)); | 300 | let mut builder = self.builders.entry(file_id).or_insert(AssistBuilder::new(file_id)); |
305 | f(&mut builder); | 301 | f(&mut builder); |
@@ -312,3 +308,9 @@ impl AssistDirector { | |||
312 | .collect::<Vec<SourceChange>>() | 308 | .collect::<Vec<SourceChange>>() |
313 | } | 309 | } |
314 | } | 310 | } |
311 | |||
312 | impl Default for AssistDirector { | ||
313 | fn default() -> Self { | ||
314 | AssistDirector { builders: FxHashMap::default() } | ||
315 | } | ||
316 | } | ||