@@ -725,10 +725,12 @@ impl<T> Vec<T> {
725725 }
726726
727727 /// Create a draining iterator that removes the specified range in the vector
728- /// and yields the removed items from start to end. The element range is
729- /// removed even if the iterator is not consumed until the end.
728+ /// and yields the removed items.
730729 ///
731- /// Note: It is unspecified how many elements are removed from the vector,
730+ /// Note 1: The element range is removed even if the iterator is not
731+ /// consumed until the end.
732+ ///
733+ /// Note 2: It is unspecified how many elements are removed from the vector,
732734 /// if the `Drain` value is leaked.
733735 ///
734736 /// # Panics
@@ -739,11 +741,14 @@ impl<T> Vec<T> {
739741 /// # Examples
740742 ///
741743 /// ```
742- /// // Draining using `..` clears the whole vector.
743744 /// let mut v = vec![1, 2, 3];
744- /// let u: Vec<_> = v.drain(..).collect();
745+ /// let u: Vec<_> = v.drain(1..).collect();
746+ /// assert_eq!(v, &[1]);
747+ /// assert_eq!(u, &[2, 3]);
748+ ///
749+ /// // A full range clears the vector
750+ /// v.drain(..);
745751 /// assert_eq!(v, &[]);
746- /// assert_eq!(u, &[1, 2, 3]);
747752 /// ```
748753 #[ stable( feature = "drain" , since = "1.6.0" ) ]
749754 pub fn drain < R > ( & mut self , range : R ) -> Drain < T >
0 commit comments