Skip to content

Commit 78540e7

Browse files
committed
Fix clippy::new-without-default for HashArena
1 parent ee0596f commit 78540e7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/internal/arena.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ impl<T: Hash + Eq + fmt::Debug> fmt::Debug for HashArena<T> {
150150

151151
impl<T: Hash + Eq> HashArena<T> {
152152
pub fn new() -> Self {
153-
HashArena {
154-
data: FnvIndexSet::default(),
155-
}
153+
Self::default()
156154
}
157155

158156
pub fn alloc(&mut self, value: T) -> Id<T> {
@@ -161,6 +159,14 @@ impl<T: Hash + Eq> HashArena<T> {
161159
}
162160
}
163161

162+
impl<T: Hash + Eq> Default for HashArena<T> {
163+
fn default() -> Self {
164+
Self {
165+
data: FnvIndexSet::default(),
166+
}
167+
}
168+
}
169+
164170
impl<T: Hash + Eq> Index<Id<T>> for HashArena<T> {
165171
type Output = T;
166172
fn index(&self, id: Id<T>) -> &T {

0 commit comments

Comments
 (0)