Skip to content

Commit 018f0a1

Browse files
authored
assert that the shard count is not 1 (#273)
* assert that the shard count is not 1 * lint
1 parent 6616a8d commit 018f0a1

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<'a, K: 'a + Eq + Hash, V: 'a, S: BuildHasher + Clone> DashMap<K, V, S> {
270270
hasher: S,
271271
shard_amount: usize,
272272
) -> Self {
273-
assert!(shard_amount > 0);
273+
assert!(shard_amount > 1);
274274
assert!(shard_amount.is_power_of_two());
275275

276276
let shift = util::ptr_size_bits() - ncb(shard_amount);

src/mapref/entry.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> VacantEntry<'a, K, V, S> {
159159

160160
let kptr: *const K = k;
161161
let vptr: *mut V = v.as_ptr();
162-
let r = OccupiedEntry::new(self.shard, self.key, (kptr, vptr));
163-
164-
r
162+
OccupiedEntry::new(self.shard, self.key, (kptr, vptr))
165163
}
166164
}
167165

0 commit comments

Comments
 (0)