Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/prime_caches/topologic_sort.rs')
| -rw-r--r-- | crates/ide-db/src/prime_caches/topologic_sort.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ide-db/src/prime_caches/topologic_sort.rs b/crates/ide-db/src/prime_caches/topologic_sort.rs index 7353d71fa4..c8a0386310 100644 --- a/crates/ide-db/src/prime_caches/topologic_sort.rs +++ b/crates/ide-db/src/prime_caches/topologic_sort.rs @@ -7,14 +7,20 @@ pub(crate) struct TopologicSortIterBuilder<T> { nodes: FxHashMap<T, Entry<T>>, } -impl<T> TopologicSortIterBuilder<T> +// this implementation has different bounds on T than would be implied by #[derive(Default)] +impl<T> Default for TopologicSortIterBuilder<T> where T: Copy + Eq + PartialEq + Hash, { - fn new() -> Self { + fn default() -> Self { Self { nodes: Default::default() } } +} +impl<T> TopologicSortIterBuilder<T> +where + T: Copy + Eq + PartialEq + Hash, +{ fn get_or_create_entry(&mut self, item: T) -> &mut Entry<T> { self.nodes.entry(item).or_default() } @@ -54,7 +60,7 @@ where T: Copy + Eq + PartialEq + Hash, { pub(crate) fn builder() -> TopologicSortIterBuilder<T> { - TopologicSortIterBuilder::new() + TopologicSortIterBuilder::default() } pub(crate) fn pending(&self) -> usize { |