mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Docs: recommend VecDeque instead of Vec::remove(0)
This commit is contained in:
parent
48e89b00ca
commit
361ef2aadc
@ -1372,9 +1372,12 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
///
|
||||
/// Note: Because this shifts over the remaining elements, it has a
|
||||
/// worst-case performance of *O*(*n*). If you don't need the order of elements
|
||||
/// to be preserved, use [`swap_remove`] instead.
|
||||
/// to be preserved, use [`swap_remove`] instead. If you'd like to remove
|
||||
/// elements from the beginning of the `Vec`, consider using
|
||||
/// [`VecDeque::pop_front`] instead.
|
||||
///
|
||||
/// [`swap_remove`]: Vec::swap_remove
|
||||
/// [`VecDeque::pop_front`]: crate::collections::VecDeque::pop_front
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
@ -1735,6 +1738,11 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// Removes the last element from a vector and returns it, or [`None`] if it
|
||||
/// is empty.
|
||||
///
|
||||
/// If you'd like to pop the first element, consider using
|
||||
/// [`VecDeque::pop_front`] instead.
|
||||
///
|
||||
/// [`VecDeque::pop_front`]: crate::collections::VecDeque::pop_front
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
Loading…
Reference in New Issue
Block a user