Skip to content

Commit 132d31e

Browse files
committed
Fix clippy
1 parent 63968ab commit 132d31e

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/external_trait_impls/rayon/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ where
346346
self.len() == other.len()
347347
&& self
348348
.into_par_iter()
349-
.all(|(key, value)| other.get(key).map_or(false, |v| *value == *v))
349+
.all(|(key, value)| other.get(key).is_some_and(|v| *value == *v))
350350
}
351351
}
352352

@@ -455,7 +455,7 @@ where
455455
// Reserve the entire length if the map is empty.
456456
// Otherwise reserve half the length (rounded up), so the map
457457
// will only resize twice in the worst case.
458-
let reserve = if map.is_empty() { len } else { (len + 1) / 2 };
458+
let reserve = if map.is_empty() { len } else { len.div_ceil(2) };
459459
map.reserve(reserve);
460460
for vec in list {
461461
map.extend(vec);

src/external_trait_impls/rayon/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ where
384384
// Reserve the entire length if the set is empty.
385385
// Otherwise reserve half the length (rounded up), so the set
386386
// will only resize twice in the worst case.
387-
let reserve = if set.is_empty() { len } else { (len + 1) / 2 };
387+
let reserve = if set.is_empty() { len } else { len.div_ceil(2) };
388388
set.reserve(reserve);
389389
for vec in list {
390390
set.extend(vec);

src/map.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ where
242242
Q: Hash + ?Sized,
243243
S: BuildHasher,
244244
{
245-
use core::hash::Hasher;
246-
let mut state = hash_builder.build_hasher();
247-
val.hash(&mut state);
248-
state.finish()
245+
hash_builder.hash_one(val)
249246
}
250247

251248
#[cfg(feature = "nightly")]
@@ -2022,7 +2019,7 @@ where
20222019
}
20232020

20242021
self.iter()
2025-
.all(|(key, value)| other.get(key).map_or(false, |v| *value == *v))
2022+
.all(|(key, value)| other.get(key).is_some_and(|v| *value == *v))
20262023
}
20272024
}
20282025

@@ -4486,7 +4483,7 @@ where
44864483
let reserve = if self.is_empty() {
44874484
iter.size_hint().0
44884485
} else {
4489-
(iter.size_hint().0 + 1) / 2
4486+
iter.size_hint().0.div_ceil(2)
44904487
};
44914488
self.reserve(reserve);
44924489
iter.for_each(move |(k, v)| {

0 commit comments

Comments
 (0)