Skip to content

Commit

Permalink
assert that the shard count is not 1 (#273)
Browse files Browse the repository at this point in the history
* assert that the shard count is not 1

* lint
  • Loading branch information
xacrimon committed Jul 11, 2023
1 parent 6616a8d commit 018f0a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
hasher: S,
shard_amount: usize,
) -> Self {
assert!(shard_amount > 0);
assert!(shard_amount > 1);
assert!(shard_amount.is_power_of_two());

let shift = util::ptr_size_bits() - ncb(shard_amount);
Expand Down
4 changes: 1 addition & 3 deletions src/mapref/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> VacantEntry<'a, K, V, S> {

let kptr: *const K = k;
let vptr: *mut V = v.as_ptr();
let r = OccupiedEntry::new(self.shard, self.key, (kptr, vptr));

r
OccupiedEntry::new(self.shard, self.key, (kptr, vptr))
}
}

Expand Down

0 comments on commit 018f0a1

Please sign in to comment.