mirror of https://github.com/xacrimon/dashmap
assert that the shard count is not 1 (#273)
* assert that the shard count is not 1 * lint
This commit is contained in:
parent
6616a8d28c
commit
018f0a1671
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue