@@ -655,7 +655,6 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for IterMut<'a, A> {
655
655
impl < ' a , A > ExactSizeIterator < & ' a mut A > for IterMut < ' a , A > { }
656
656
657
657
/// Allows mutating a `DList` while iterating.
658
- #[ deprecated = "Trait is deprecated, use inherent methods on the iterator instead" ]
659
658
pub trait ListInsertion < A > {
660
659
/// Inserts `elt` just after to the element most recently returned by
661
660
/// `.next()`
@@ -690,50 +689,14 @@ impl<'a, A> IterMut<'a, A> {
690
689
}
691
690
}
692
691
693
- impl < ' a , A > IterMut < ' a , A > {
694
- /// Inserts `elt` just after the element most recently returned by `.next()`.
695
- /// The inserted element does not appear in the iteration.
696
- ///
697
- /// # Examples
698
- ///
699
- /// ```rust
700
- /// use std::collections::DList;
701
- ///
702
- /// let mut list: DList<int> = vec![1, 3, 4].into_iter().collect();
703
- ///
704
- /// {
705
- /// let mut it = list.iter_mut();
706
- /// assert_eq!(it.next().unwrap(), &1);
707
- /// // insert `2` after `1`
708
- /// it.insert_next(2);
709
- /// }
710
- /// {
711
- /// let vec: Vec<int> = list.into_iter().collect();
712
- /// assert_eq!(vec, vec![1i, 2, 3, 4]);
713
- /// }
714
- /// ```
692
+ impl < ' a , A > ListInsertion < A > for IterMut < ' a , A > {
715
693
#[ inline]
716
- pub fn insert_next ( & mut self , elt : A ) {
694
+ fn insert_next ( & mut self , elt : A ) {
717
695
self . insert_next_node ( box Node :: new ( elt) )
718
696
}
719
697
720
- /// Provides a reference to the next element, without changing the iterator.
721
- ///
722
- /// # Examples
723
- ///
724
- /// ```rust
725
- /// use std::collections::DList;
726
- ///
727
- /// let mut list: DList<int> = vec![1, 2, 3].into_iter().collect();
728
- ///
729
- /// let mut it = list.iter_mut();
730
- /// assert_eq!(it.next().unwrap(), &1);
731
- /// assert_eq!(it.peek_next().unwrap(), &2);
732
- /// // We just peeked at 2, so it was not consumed from the iterator.
733
- /// assert_eq!(it.next().unwrap(), &2);
734
- /// ```
735
698
#[ inline]
736
- pub fn peek_next ( & mut self ) -> Option < & mut A > {
699
+ fn peek_next ( & mut self ) -> Option < & mut A > {
737
700
if self . nelem == 0 {
738
701
return None
739
702
}
@@ -835,7 +798,7 @@ mod tests {
835
798
use test:: Bencher ;
836
799
use test;
837
800
838
- use super :: { DList , Node } ;
801
+ use super :: { DList , Node , ListInsertion } ;
839
802
840
803
pub fn check_links < T > ( list : & DList < T > ) {
841
804
let mut len = 0 u;
0 commit comments