@@ -142,7 +142,7 @@ impl<T> LinkedList<T> {
142142
143143 match self . head {
144144 None => self . tail = node,
145- Some ( head) => ( * * head) . prev = node,
145+ Some ( head) => ( * head. as_mut_ptr ( ) ) . prev = node,
146146 }
147147
148148 self . head = node;
@@ -154,12 +154,12 @@ impl<T> LinkedList<T> {
154154 #[ inline]
155155 fn pop_front_node ( & mut self ) -> Option < Box < Node < T > > > {
156156 self . head . map ( |node| unsafe {
157- let node = Box :: from_raw ( * node) ;
157+ let node = Box :: from_raw ( node. as_mut_ptr ( ) ) ;
158158 self . head = node. next ;
159159
160160 match self . head {
161161 None => self . tail = None ,
162- Some ( head) => ( * * head) . prev = None ,
162+ Some ( head) => ( * head. as_mut_ptr ( ) ) . prev = None ,
163163 }
164164
165165 self . len -= 1 ;
@@ -177,7 +177,7 @@ impl<T> LinkedList<T> {
177177
178178 match self . tail {
179179 None => self . head = node,
180- Some ( tail) => ( * * tail) . next = node,
180+ Some ( tail) => ( * tail. as_mut_ptr ( ) ) . next = node,
181181 }
182182
183183 self . tail = node;
@@ -189,12 +189,12 @@ impl<T> LinkedList<T> {
189189 #[ inline]
190190 fn pop_back_node ( & mut self ) -> Option < Box < Node < T > > > {
191191 self . tail . map ( |node| unsafe {
192- let node = Box :: from_raw ( * node) ;
192+ let node = Box :: from_raw ( node. as_mut_ptr ( ) ) ;
193193 self . tail = node. prev ;
194194
195195 match self . tail {
196196 None => self . head = None ,
197- Some ( tail) => ( * * tail) . next = None ,
197+ Some ( tail) => ( * tail. as_mut_ptr ( ) ) . next = None ,
198198 }
199199
200200 self . len -= 1 ;
@@ -269,8 +269,8 @@ impl<T> LinkedList<T> {
269269 Some ( tail) => {
270270 if let Some ( other_head) = other. head . take ( ) {
271271 unsafe {
272- ( * * tail) . next = Some ( other_head) ;
273- ( * * other_head) . prev = Some ( tail) ;
272+ ( * tail. as_mut_ptr ( ) ) . next = Some ( other_head) ;
273+ ( * other_head. as_mut_ptr ( ) ) . prev = Some ( tail) ;
274274 }
275275
276276 self . tail = other. tail . take ( ) ;
@@ -484,7 +484,7 @@ impl<T> LinkedList<T> {
484484 #[ inline]
485485 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
486486 pub fn front_mut ( & mut self ) -> Option < & mut T > {
487- self . head . map ( |node| unsafe { & mut ( * * node) . element } )
487+ self . head . map ( |node| unsafe { & mut ( * node. as_mut_ptr ( ) ) . element } )
488488 }
489489
490490 /// Provides a reference to the back element, or `None` if the list is
@@ -530,7 +530,7 @@ impl<T> LinkedList<T> {
530530 #[ inline]
531531 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
532532 pub fn back_mut ( & mut self ) -> Option < & mut T > {
533- self . tail . map ( |node| unsafe { & mut ( * * node) . element } )
533+ self . tail . map ( |node| unsafe { & mut ( * node. as_mut_ptr ( ) ) . element } )
534534 }
535535
536536 /// Adds an element first in the list.
@@ -675,9 +675,9 @@ impl<T> LinkedList<T> {
675675 let second_part_head;
676676
677677 unsafe {
678- second_part_head = ( * * split_node. unwrap ( ) ) . next . take ( ) ;
678+ second_part_head = ( * split_node. unwrap ( ) . as_mut_ptr ( ) ) . next . take ( ) ;
679679 if let Some ( head) = second_part_head {
680- ( * * head) . prev = None ;
680+ ( * head. as_mut_ptr ( ) ) . prev = None ;
681681 }
682682 }
683683
@@ -816,7 +816,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
816816 None
817817 } else {
818818 self . head . map ( |node| unsafe {
819- let node = & mut * * node;
819+ let node = & mut * node. as_mut_ptr ( ) ;
820820 self . len -= 1 ;
821821 self . head = node. next ;
822822 & mut node. element
@@ -838,7 +838,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
838838 None
839839 } else {
840840 self . tail . map ( |node| unsafe {
841- let node = & mut * * node;
841+ let node = & mut * node. as_mut_ptr ( ) ;
842842 self . len -= 1 ;
843843 self . tail = node. prev ;
844844 & mut node. element
@@ -896,8 +896,8 @@ impl<'a, T> IterMut<'a, T> {
896896 element : element,
897897 } ) ) ) ;
898898
899- ( * * prev) . next = node;
900- ( * * head) . prev = node;
899+ ( * prev. as_mut_ptr ( ) ) . next = node;
900+ ( * head. as_mut_ptr ( ) ) . prev = node;
901901
902902 self . list . len += 1 ;
903903 } ,
@@ -929,7 +929,7 @@ impl<'a, T> IterMut<'a, T> {
929929 if self . len == 0 {
930930 None
931931 } else {
932- self . head . map ( |node| unsafe { & mut ( * * node) . element } )
932+ self . head . map ( |node| unsafe { & mut ( * node. as_mut_ptr ( ) ) . element } )
933933 }
934934 }
935935}
0 commit comments