Skip to content

Commit 4984520

Browse files
committed
Use default instead of new in AssistDirector
1 parent fce1020 commit 4984520

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

crates/ra_assists/src/assist_context.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl Assists {
181181
if !self.resolve {
182182
return None;
183183
}
184-
let mut director = AssistDirector::new();
184+
let mut director = AssistDirector::default();
185185
f(&mut director);
186186
let changes = director.finish();
187187
let file_edits: Vec<SourceFileEdit> =
@@ -296,10 +296,6 @@ pub(crate) struct AssistDirector {
296296
}
297297

298298
impl AssistDirector {
299-
fn new() -> AssistDirector {
300-
AssistDirector { builders: FxHashMap::default() }
301-
}
302-
303299
pub(crate) fn perform(&mut self, file_id: FileId, f: impl FnOnce(&mut AssistBuilder)) {
304300
let mut builder = self.builders.entry(file_id).or_insert(AssistBuilder::new(file_id));
305301
f(&mut builder);
@@ -312,3 +308,9 @@ impl AssistDirector {
312308
.collect::<Vec<SourceChange>>()
313309
}
314310
}
311+
312+
impl Default for AssistDirector {
313+
fn default() -> Self {
314+
AssistDirector { builders: FxHashMap::default() }
315+
}
316+
}

0 commit comments

Comments
 (0)