Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Jun 19, 2024
1 parent e2b6b85 commit 268414b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6718,7 +6718,6 @@ mod test_map {
use rand::{rngs::SmallRng, Rng, SeedableRng};
use std::borrow::ToOwned;
use std::cell::RefCell;
use std::usize;
use std::vec::Vec;

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ impl<T, A: Allocator> RawTable<T, A> {
fallibility,
Self::TABLE_LAYOUT,
if T::NEEDS_DROP {
Some(mem::transmute(ptr::drop_in_place::<T> as unsafe fn(*mut T)))
Some(|ptr| ptr::drop_in_place(ptr as *mut T))
} else {
None
},
Expand Down Expand Up @@ -2911,7 +2911,7 @@ impl RawTableInner {
hasher: &dyn Fn(&mut Self, usize) -> u64,
fallibility: Fallibility,
layout: TableLayout,
drop: Option<fn(*mut u8)>,
drop: Option<unsafe fn(*mut u8)>,
) -> Result<(), TryReserveError>
where
A: Allocator,
Expand Down Expand Up @@ -3145,7 +3145,7 @@ impl RawTableInner {
&mut self,
hasher: &dyn Fn(&mut Self, usize) -> u64,
size_of: usize,
drop: Option<fn(*mut u8)>,
drop: Option<unsafe fn(*mut u8)>,
) {
// If the hash function panics then properly clean up any elements
// that we haven't rehashed yet. We unfortunately can't preserve the
Expand Down Expand Up @@ -4577,7 +4577,7 @@ mod test_map {
&|table, index| hasher(table.bucket::<T>(index).as_ref()),
mem::size_of::<T>(),
if mem::needs_drop::<T>() {
Some(mem::transmute(ptr::drop_in_place::<T> as unsafe fn(*mut T)))
Some(|ptr| ptr::drop_in_place(ptr as *mut T))
} else {
None
},
Expand Down
6 changes: 3 additions & 3 deletions tests/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ fn check<S: BuildHasher + Default>() {
let mut set = HashSet::<i32, S>::default();
set.extend(range.clone());

assert!(!set.contains(&i32::min_value()));
assert!(!set.contains(&i32::MIN));
assert!(!set.contains(&(range.start - 1)));
for i in range.clone() {
assert!(set.contains(&i));
}
assert!(!set.contains(&range.end));
assert!(!set.contains(&i32::max_value()));
assert!(!set.contains(&i32::MAX));
}

/// Use hashbrown's default hasher.
Expand Down Expand Up @@ -56,7 +56,7 @@ fn max() {

impl Hasher for MaxHasher {
fn finish(&self) -> u64 {
u64::max_value()
u64::MAX
}
fn write(&mut self, _: &[u8]) {}
}
Expand Down

0 comments on commit 268414b

Please sign in to comment.