@@ -1215,15 +1215,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
12151215 unsafe { IterMut :: new ( ring, tail, head, PhantomData ) }
12161216 }
12171217
1218- /// Creates a draining iterator that removes the specified range in the
1219- /// `VecDeque` and yields the removed items .
1218+ /// Removes the specified range from the `VecDeque`, returning all removed
1219+ /// elements as an iterator .
12201220 ///
1221- /// Note 1: The element range is removed even if the iterator is not
1222- /// consumed until the end.
1223- ///
1224- /// Note 2: It is unspecified how many elements are removed from the deque,
1225- /// if the `Drain` value is not dropped, but the borrow it holds expires
1226- /// (e.g., due to `mem::forget`).
1221+ /// When the iterator **is** dropped, it drops any elements that it has not
1222+ /// yet yielded (none if the iterator was fully consumed).
1223+ /// If the iterator **is not** dropped (with [`mem::forget`], for example),
1224+ /// it is unspecified which elements remain in the vector; even elements
1225+ /// outside the range may have been removed and leaked.
12271226 ///
12281227 /// # Panics
12291228 ///
@@ -1240,7 +1239,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
12401239 /// assert_eq!(drained, [3]);
12411240 /// assert_eq!(v, [1, 2]);
12421241 ///
1243- /// // A full range clears all contents
1242+ /// // A full range clears all contents, like `clear()` does
12441243 /// v.drain(..);
12451244 /// assert!(v.is_empty());
12461245 /// ```
0 commit comments