@@ -1099,68 +1099,6 @@ impl<T> ExactSizeIterator for IterMut<'_, T> {}
10991099#[ stable( feature = "fused" , since = "1.26.0" ) ]
11001100impl < T > FusedIterator for IterMut < ' _ , T > { }
11011101
1102- impl < T > IterMut < ' _ , T > {
1103- /// Inserts the given element just after the element most recently returned by `.next()`.
1104- /// The inserted element does not appear in the iteration.
1105- ///
1106- /// This method will be removed soon.
1107- #[ inline]
1108- #[ unstable(
1109- feature = "linked_list_extras" ,
1110- reason = "this is probably better handled by a cursor type -- we'll see" ,
1111- issue = "27794"
1112- ) ]
1113- #[ rustc_deprecated(
1114- reason = "Deprecated in favor of CursorMut methods. This method will be removed soon." ,
1115- since = "1.47.0"
1116- ) ]
1117- pub fn insert_next ( & mut self , element : T ) {
1118- match self . head {
1119- // `push_back` is okay with aliasing `element` references
1120- None => self . list . push_back ( element) ,
1121- Some ( head) => unsafe {
1122- let prev = match head. as_ref ( ) . prev {
1123- // `push_front` is okay with aliasing nodes
1124- None => return self . list . push_front ( element) ,
1125- Some ( prev) => prev,
1126- } ;
1127-
1128- let node = Some (
1129- Box :: leak ( box Node { next : Some ( head) , prev : Some ( prev) , element } ) . into ( ) ,
1130- ) ;
1131-
1132- // Not creating references to entire nodes to not invalidate the
1133- // reference to `element` we handed to the user.
1134- ( * prev. as_ptr ( ) ) . next = node;
1135- ( * head. as_ptr ( ) ) . prev = node;
1136-
1137- self . list . len += 1 ;
1138- } ,
1139- }
1140- }
1141-
1142- /// Provides a reference to the next element, without changing the iterator.
1143- ///
1144- /// This method will be removed soon.
1145- #[ inline]
1146- #[ unstable(
1147- feature = "linked_list_extras" ,
1148- reason = "this is probably better handled by a cursor type -- we'll see" ,
1149- issue = "27794"
1150- ) ]
1151- #[ rustc_deprecated(
1152- reason = "Deprecated in favor of CursorMut methods. This method will be removed soon." ,
1153- since = "1.47.0"
1154- ) ]
1155- pub fn peek_next ( & mut self ) -> Option < & mut T > {
1156- if self . len == 0 {
1157- None
1158- } else {
1159- unsafe { self . head . as_mut ( ) . map ( |node| & mut node. as_mut ( ) . element ) }
1160- }
1161- }
1162- }
1163-
11641102/// A cursor over a `LinkedList`.
11651103///
11661104/// A `Cursor` is like an iterator, except that it can freely seek back-and-forth.
0 commit comments