@@ -145,7 +145,7 @@ fn h2(hash: u64) -> u8 {
145
145
/// (skipping over 1 group), then 3 groups (skipping over 2 groups), and so on.
146
146
///
147
147
/// Proof that the probe will visit every group in the table:
148
- /// https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/
148
+ /// < https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/>
149
149
struct ProbeSeq {
150
150
bucket_mask : usize ,
151
151
pos : usize ,
@@ -298,7 +298,7 @@ impl<T> Bucket<T> {
298
298
} else {
299
299
self . ptr . add ( offset)
300
300
} ;
301
- Bucket { ptr }
301
+ Self { ptr }
302
302
}
303
303
#[ inline]
304
304
pub unsafe fn drop ( & self ) {
@@ -321,7 +321,7 @@ impl<T> Bucket<T> {
321
321
& mut * self . as_ptr ( )
322
322
}
323
323
#[ inline]
324
- pub unsafe fn copy_from_nonoverlapping ( & self , other : Bucket < T > ) {
324
+ pub unsafe fn copy_from_nonoverlapping ( & self , other : & Self ) {
325
325
self . as_ptr ( ) . copy_from_nonoverlapping ( other. as_ptr ( ) , 1 ) ;
326
326
}
327
327
}
@@ -745,7 +745,7 @@ impl<T> RawTable<T> {
745
745
// element into the new slot and clear the old control
746
746
// byte.
747
747
guard. set_ctrl ( i, EMPTY ) ;
748
- guard. bucket ( new_i) . copy_from_nonoverlapping ( item) ;
748
+ guard. bucket ( new_i) . copy_from_nonoverlapping ( & item) ;
749
749
continue ' outer;
750
750
} else {
751
751
// If the target slot is occupied, swap the two elements
@@ -802,7 +802,7 @@ impl<T> RawTable<T> {
802
802
// - all elements are unique.
803
803
let index = new_table. find_insert_slot ( hash) ;
804
804
new_table. set_ctrl ( index, h2 ( hash) ) ;
805
- new_table. bucket ( index) . copy_from_nonoverlapping ( item) ;
805
+ new_table. bucket ( index) . copy_from_nonoverlapping ( & item) ;
806
806
}
807
807
808
808
// We successfully copied all elements without panicking. Now replace
@@ -935,12 +935,12 @@ impl<T> RawTable<T> {
935
935
/// should be dropped using a `RawIter` before freeing the allocation.
936
936
#[ inline]
937
937
pub fn into_alloc ( self ) -> Option < ( NonNull < u8 > , Layout ) > {
938
- let alloc = if !self . is_empty_singleton ( ) {
938
+ let alloc = if self . is_empty_singleton ( ) {
939
+ None
940
+ } else {
939
941
let ( layout, _) = calculate_layout :: < T > ( self . buckets ( ) )
940
942
. unwrap_or_else ( || unsafe { hint:: unreachable_unchecked ( ) } ) ;
941
943
Some ( ( self . ctrl . cast ( ) , layout) )
942
- } else {
943
- None
944
944
} ;
945
945
mem:: forget ( self ) ;
946
946
alloc
0 commit comments