Skip to content

Commit cdebfe8

Browse files
authored
Merge pull request #318 from cuviper/cautious_capacity
Simplify `cautious_capacity` since `Bucket` is never a ZST
2 parents 43b322e + 7e64de1 commit cdebfe8

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/serde.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ use crate::{Bucket, IndexMap, IndexSet};
2323
pub(crate) fn cautious_capacity<K, V>(hint: Option<usize>) -> usize {
2424
const MAX_PREALLOC_BYTES: usize = 1024 * 1024;
2525

26-
if mem::size_of::<Bucket<K, V>>() == 0 {
27-
0
28-
} else {
29-
cmp::min(
30-
hint.unwrap_or(0),
31-
MAX_PREALLOC_BYTES / mem::size_of::<Bucket<K, V>>(),
32-
)
33-
}
26+
cmp::min(
27+
hint.unwrap_or(0),
28+
MAX_PREALLOC_BYTES / mem::size_of::<Bucket<K, V>>(),
29+
)
3430
}
3531

3632
impl<K, V, S> Serialize for IndexMap<K, V, S>

0 commit comments

Comments
 (0)