@@ -1215,15 +1215,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
1215
1215
unsafe { IterMut :: new ( ring, tail, head, PhantomData ) }
1216
1216
}
1217
1217
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 .
1220
1220
///
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.
1227
1226
///
1228
1227
/// # Panics
1229
1228
///
@@ -1240,7 +1239,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
1240
1239
/// assert_eq!(drained, [3]);
1241
1240
/// assert_eq!(v, [1, 2]);
1242
1241
///
1243
- /// // A full range clears all contents
1242
+ /// // A full range clears all contents, like `clear()` does
1244
1243
/// v.drain(..);
1245
1244
/// assert!(v.is_empty());
1246
1245
/// ```
0 commit comments