diff --git a/src/map.rs b/src/map.rs
index 86ab7b2d0c..72642a9ed3 100644
--- a/src/map.rs
+++ b/src/map.rs
@@ -1646,8 +1646,8 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
{
unsafe {
let elem = self.table.insert(hash, (key, value), |x| hasher(&x.0));
- let &mut (ref mut key, ref mut value) = elem.as_mut();
- (key, value)
+ let &mut (ref mut k, ref mut v) = elem.as_mut();
+ (k, v)
}
}
}
diff --git a/src/raw/mod.rs b/src/raw/mod.rs
index 199bdf1205..e0c7907953 100644
--- a/src/raw/mod.rs
+++ b/src/raw/mod.rs
@@ -145,7 +145,7 @@ fn h2(hash: u64) -> u8 {
/// (skipping over 1 group), then 3 groups (skipping over 2 groups), and so on.
///
/// Proof that the probe will visit every group in the table:
-/// https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/
+///
struct ProbeSeq {
bucket_mask: usize,
pos: usize,
@@ -298,7 +298,7 @@ impl Bucket {
} else {
self.ptr.add(offset)
};
- Bucket { ptr }
+ Self { ptr }
}
#[inline]
pub unsafe fn drop(&self) {
@@ -321,7 +321,7 @@ impl Bucket {
&mut *self.as_ptr()
}
#[inline]
- pub unsafe fn copy_from_nonoverlapping(&self, other: Bucket) {
+ pub unsafe fn copy_from_nonoverlapping(&self, other: &Self) {
self.as_ptr().copy_from_nonoverlapping(other.as_ptr(), 1);
}
}
@@ -745,7 +745,7 @@ impl RawTable {
// element into the new slot and clear the old control
// byte.
guard.set_ctrl(i, EMPTY);
- guard.bucket(new_i).copy_from_nonoverlapping(item);
+ guard.bucket(new_i).copy_from_nonoverlapping(&item);
continue 'outer;
} else {
// If the target slot is occupied, swap the two elements
@@ -802,7 +802,7 @@ impl RawTable {
// - all elements are unique.
let index = new_table.find_insert_slot(hash);
new_table.set_ctrl(index, h2(hash));
- new_table.bucket(index).copy_from_nonoverlapping(item);
+ new_table.bucket(index).copy_from_nonoverlapping(&item);
}
// We successfully copied all elements without panicking. Now replace
@@ -935,12 +935,12 @@ impl RawTable {
/// should be dropped using a `RawIter` before freeing the allocation.
#[inline]
pub fn into_alloc(self) -> Option<(NonNull, Layout)> {
- let alloc = if !self.is_empty_singleton() {
+ let alloc = if self.is_empty_singleton() {
+ None
+ } else {
let (layout, _) = calculate_layout::(self.buckets())
.unwrap_or_else(|| unsafe { hint::unreachable_unchecked() });
Some((self.ctrl.cast(), layout))
- } else {
- None
};
mem::forget(self);
alloc