From 4984520ef565e926ba08c6512715ed631e4527e4 Mon Sep 17 00:00:00 2001 From: Mikhail Rakhmanov Date: Sat, 23 May 2020 01:27:11 +0200 Subject: Use default instead of new in AssistDirector --- crates/ra_assists/src/assist_context.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crates') 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 { if !self.resolve { return None; } - let mut director = AssistDirector::new(); + let mut director = AssistDirector::default(); f(&mut director); let changes = director.finish(); let file_edits: Vec = @@ -296,10 +296,6 @@ pub(crate) struct AssistDirector { } impl AssistDirector { - fn new() -> AssistDirector { - AssistDirector { builders: FxHashMap::default() } - } - pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) { let mut builder = self.builders.entry(file_id).or_insert(AssistBuilder::new(file_id)); f(&mut builder); @@ -312,3 +308,9 @@ impl AssistDirector { .collect::>() } } + +impl Default for AssistDirector { + fn default() -> Self { + AssistDirector { builders: FxHashMap::default() } + } +} -- cgit v1.2.3