Skip to content

Commit

Permalink
Auto merge of rust-lang#74652 - poliorcetics:clarify-vec-drain-doc, r…
Browse files Browse the repository at this point in the history
…=jyn514

Improve the documentation for Vec::drain

Fixes rust-lang#73844.

@rusbot modify labels: A-collections, C-enhancement, T-doc, T-libs
  • Loading branch information
bors committed Jul 25, 2020
2 parents c4e1734 + 654c180 commit 0e11fc8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/liballoc/vec.rs
Expand Up @@ -1274,11 +1274,10 @@ impl<T> Vec<T> {
/// Creates a draining iterator that removes the specified range in the vector
/// and yields the removed items.
///
/// Note 1: The element range is removed even if the iterator is only
/// partially consumed or not consumed at all.
///
/// Note 2: It is unspecified how many elements are removed from the vector
/// if the `Drain` value is leaked.
/// When the iterator **is** dropped, all elements in the range are removed
/// from the vector, even if the iterator was not fully consumed. If the
/// iterator **is not** dropped (with [`mem::forget`] for example), it is
/// unspecified how many elements are removed.
///
/// # Panics
///
Expand Down

0 comments on commit 0e11fc8

Please sign in to comment.