@@ -2511,9 +2511,9 @@ impl<T, A: Allocator> Vec<T, A> {
25112511 }
25122512 }
25132513
2514- /// Removes and returns the last element in a vector if the predicate
2514+ /// Removes and returns the last element from a vector if the predicate
25152515 /// returns `true`, or [`None`] if the predicate returns false or the vector
2516- /// is empty.
2516+ /// is empty (the predicate will not be called in that case) .
25172517 ///
25182518 /// # Examples
25192519 ///
@@ -2528,12 +2528,9 @@ impl<T, A: Allocator> Vec<T, A> {
25282528 /// assert_eq!(vec.pop_if(pred), None);
25292529 /// ```
25302530 #[ unstable( feature = "vec_pop_if" , issue = "122741" ) ]
2531- pub fn pop_if < F > ( & mut self , f : F ) -> Option < T >
2532- where
2533- F : FnOnce ( & mut T ) -> bool ,
2534- {
2531+ pub fn pop_if ( & mut self , predicate : impl FnOnce ( & mut T ) -> bool ) -> Option < T > {
25352532 let last = self . last_mut ( ) ?;
2536- if f ( last) { self . pop ( ) } else { None }
2533+ if predicate ( last) { self . pop ( ) } else { None }
25372534 }
25382535
25392536 /// Moves all the elements of `other` into `self`, leaving `other` empty.
@@ -2574,9 +2571,11 @@ impl<T, A: Allocator> Vec<T, A> {
25742571 self . len += count;
25752572 }
25762573
2577- /// Removes the specified range from the vector in bulk, returning all
2578- /// removed elements as an iterator. If the iterator is dropped before
2579- /// being fully consumed, it drops the remaining removed elements.
2574+ /// Removes the subslice indicated by the given range from the vector,
2575+ /// returning a double-ended iterator over the removed subslice.
2576+ ///
2577+ /// If the iterator is dropped before being fully consumed,
2578+ /// it drops the remaining removed elements.
25802579 ///
25812580 /// The returned iterator keeps a mutable borrow on the vector to optimize
25822581 /// its implementation.
@@ -3016,10 +3015,9 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
30163015 /// Iterates over the slice `other`, clones each element, and then appends
30173016 /// it to this `Vec`. The `other` slice is traversed in-order.
30183017 ///
3019- /// Note that this function is same as [`extend`] except that it is
3020- /// specialized to work with slices instead. If and when Rust gets
3021- /// specialization this function will likely be deprecated (but still
3022- /// available).
3018+ /// Note that this function is the same as [`extend`],
3019+ /// except that it also works with slice elements that are Clone but not Copy.
3020+ /// If Rust gets specialization this function may be deprecated.
30233021 ///
30243022 /// # Examples
30253023 ///
0 commit comments