@@ -26,7 +26,7 @@ pub(super) struct DebugIndices<'a>(pub &'a RawTable<usize>);
2626impl fmt:: Debug for DebugIndices < ' _ > {
2727 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
2828 // SAFETY: we're not letting any of the buckets escape this function
29- let indices = unsafe { self . 0 . iter ( ) . map ( |raw_bucket| raw_bucket. read ( ) ) } ;
29+ let indices = unsafe { self . 0 . iter ( ) . map ( |raw_bucket| * raw_bucket. as_ref ( ) ) } ;
3030 f. debug_list ( ) . entries ( indices) . finish ( )
3131 }
3232}
@@ -38,10 +38,10 @@ impl<K, V> IndexMapCore<K, V> {
3838 unsafe {
3939 let offset = end - start;
4040 for bucket in self . indices . iter ( ) {
41- let i = bucket. read ( ) ;
42- if i >= end {
43- bucket . write ( i - offset) ;
44- } else if i >= start {
41+ let i = bucket. as_mut ( ) ;
42+ if * i >= end {
43+ * i -= offset;
44+ } else if * i >= start {
4545 self . indices . erase ( bucket) ;
4646 }
4747 }
@@ -92,8 +92,8 @@ impl<K, V> IndexMapCore<K, V> {
9292 unsafe {
9393 let raw_bucket_a = self . find_index ( a) ;
9494 let raw_bucket_b = self . find_index ( b) ;
95- raw_bucket_a. write ( b ) ;
96- raw_bucket_b. write ( a ) ;
95+ * raw_bucket_a. as_mut ( ) = b ;
96+ * raw_bucket_b. as_mut ( ) = a ;
9797 }
9898 self . entries . swap ( a, b) ;
9999 }
@@ -151,7 +151,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
151151 #[ inline]
152152 pub fn index ( & self ) -> usize {
153153 // SAFETY: we have &mut map keep keeping the bucket stable
154- unsafe { self . raw_bucket . read ( ) }
154+ unsafe { * self . raw_bucket . as_ref ( ) }
155155 }
156156
157157 /// Converts into a mutable reference to the entry's value in the map,
0 commit comments