Skip to content

Commit

Permalink
fix(compat): avoid using std::iter::repeat_n
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy committed Nov 2, 2024
1 parent ebf89c8 commit f175f76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/shard_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ where
V: 'static,
{
pub fn new() -> Self {
let n_shards = num_cpus::get().max(4);
let shards = std::iter::repeat_n((), n_shards)
let shards = std::iter::repeat(())
.take(num_cpus::get().max(4))
.map(|_| Shard::new())
.collect();

Expand All @@ -62,9 +62,11 @@ where
}

pub fn new_with_shards(shards: usize) -> Self {
let shards = std::iter::repeat_n((), shards)
let shards = std::iter::repeat(())
.take(shards)
.map(|_| Shard::new())
.collect();

Self {
inner: Arc::new(Inner {
shards,
Expand Down

0 comments on commit f175f76

Please sign in to comment.