@@ -1031,7 +1031,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10311031
10321032 /// Retains only the elements specified by the predicate.
10331033 ///
1034- /// In other words, remove all elements `e` for which `f(&e)` returns false.
1034+ /// In other words, remove all elements `e` for which `f(&mut e)` returns false.
10351035 /// This method operates in place, visiting each element exactly once in the
10361036 /// original order, and preserves the order of the retained elements.
10371037 ///
@@ -1047,7 +1047,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
10471047 /// d.push_front(2);
10481048 /// d.push_front(3);
10491049 ///
1050- /// d.retain(|&x| x % 2 == 0);
1050+ /// d.retain(|&mut x| x % 2 == 0);
10511051 ///
10521052 /// assert_eq!(d.pop_front(), Some(2));
10531053 /// assert_eq!(d.pop_front(), None);
@@ -1074,41 +1074,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
10741074 /// ```
10751075 #[ unstable( feature = "linked_list_retain" , issue = "114135" ) ]
10761076 pub fn retain < F > ( & mut self , mut f : F )
1077- where
1078- F : FnMut ( & T ) -> bool ,
1079- {
1080- self . retain_mut ( |elem| f ( elem) ) ;
1081- }
1082-
1083- /// Retains only the elements specified by the predicate.
1084- ///
1085- /// In other words, remove all elements `e` for which `f(&mut e)` returns false.
1086- /// This method operates in place, visiting each element exactly once in the
1087- /// original order, and preserves the order of the retained elements.
1088- ///
1089- /// # Examples
1090- ///
1091- /// ```
1092- /// #![feature(linked_list_retain)]
1093- /// use std::collections::LinkedList;
1094- ///
1095- /// let mut d = LinkedList::new();
1096- ///
1097- /// d.push_front(1);
1098- /// d.push_front(2);
1099- /// d.push_front(3);
1100- ///
1101- /// d.retain_mut(|x| if *x % 2 == 0 {
1102- /// *x += 1;
1103- /// true
1104- /// } else {
1105- /// false
1106- /// });
1107- /// assert_eq!(d.pop_front(), Some(3));
1108- /// assert_eq!(d.pop_front(), None);
1109- /// ```
1110- #[ unstable( feature = "linked_list_retain" , issue = "114135" ) ]
1111- pub fn retain_mut < F > ( & mut self , mut f : F )
11121077 where
11131078 F : FnMut ( & mut T ) -> bool ,
11141079 {
0 commit comments