Skip to content

Commit b6f6283

Browse files
Copilotsiriak
andcommitted
Address code review feedback: use vec! macro and repeat_with for clarity
Co-authored-by: siriak <29201949+siriak@users.noreply.github.com>
1 parent 1d61cae commit b6f6283

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/data_structures/probabilistic/count_min_sketch.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ impl<T: Hash, const WIDTH: usize, const DEPTH: usize> Default
106106
for HashCountMinSketch<T, WIDTH, DEPTH>
107107
{
108108
fn default() -> Self {
109-
let hashers = (0..DEPTH).map(|_| RandomState::new()).collect();
109+
let hashers = std::iter::repeat_with(RandomState::new)
110+
.take(DEPTH)
111+
.collect();
110112

111113
Self {
112114
phantom: std::marker::PhantomData,
113-
counts: (0..DEPTH).map(|_| [0; WIDTH]).collect(),
115+
counts: vec![[0; WIDTH]; DEPTH],
114116
hashers,
115117
}
116118
}

0 commit comments

Comments
 (0)