Skip to content

Commit 268414b

Browse files
committed
Fix clippy warnings
1 parent e2b6b85 commit 268414b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/map.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6718,7 +6718,6 @@ mod test_map {
67186718
use rand::{rngs::SmallRng, Rng, SeedableRng};
67196719
use std::borrow::ToOwned;
67206720
use std::cell::RefCell;
6721-
use std::usize;
67226721
use std::vec::Vec;
67236722

67246723
#[test]

src/raw/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ impl<T, A: Allocator> RawTable<T, A> {
12351235
fallibility,
12361236
Self::TABLE_LAYOUT,
12371237
if T::NEEDS_DROP {
1238-
Some(mem::transmute(ptr::drop_in_place::<T> as unsafe fn(*mut T)))
1238+
Some(|ptr| ptr::drop_in_place(ptr as *mut T))
12391239
} else {
12401240
None
12411241
},
@@ -2911,7 +2911,7 @@ impl RawTableInner {
29112911
hasher: &dyn Fn(&mut Self, usize) -> u64,
29122912
fallibility: Fallibility,
29132913
layout: TableLayout,
2914-
drop: Option<fn(*mut u8)>,
2914+
drop: Option<unsafe fn(*mut u8)>,
29152915
) -> Result<(), TryReserveError>
29162916
where
29172917
A: Allocator,
@@ -3145,7 +3145,7 @@ impl RawTableInner {
31453145
&mut self,
31463146
hasher: &dyn Fn(&mut Self, usize) -> u64,
31473147
size_of: usize,
3148-
drop: Option<fn(*mut u8)>,
3148+
drop: Option<unsafe fn(*mut u8)>,
31493149
) {
31503150
// If the hash function panics then properly clean up any elements
31513151
// that we haven't rehashed yet. We unfortunately can't preserve the
@@ -4577,7 +4577,7 @@ mod test_map {
45774577
&|table, index| hasher(table.bucket::<T>(index).as_ref()),
45784578
mem::size_of::<T>(),
45794579
if mem::needs_drop::<T>() {
4580-
Some(mem::transmute(ptr::drop_in_place::<T> as unsafe fn(*mut T)))
4580+
Some(|ptr| ptr::drop_in_place(ptr as *mut T))
45814581
} else {
45824582
None
45834583
},

tests/hasher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ fn check<S: BuildHasher + Default>() {
1111
let mut set = HashSet::<i32, S>::default();
1212
set.extend(range.clone());
1313

14-
assert!(!set.contains(&i32::min_value()));
14+
assert!(!set.contains(&i32::MIN));
1515
assert!(!set.contains(&(range.start - 1)));
1616
for i in range.clone() {
1717
assert!(set.contains(&i));
1818
}
1919
assert!(!set.contains(&range.end));
20-
assert!(!set.contains(&i32::max_value()));
20+
assert!(!set.contains(&i32::MAX));
2121
}
2222

2323
/// Use hashbrown's default hasher.
@@ -56,7 +56,7 @@ fn max() {
5656

5757
impl Hasher for MaxHasher {
5858
fn finish(&self) -> u64 {
59-
u64::max_value()
59+
u64::MAX
6060
}
6161
fn write(&mut self, _: &[u8]) {}
6262
}

0 commit comments

Comments
 (0)