Skip to content

Commit

Permalink
Add swap_take() alias to swap_remove() and co
Browse files Browse the repository at this point in the history
  • Loading branch information
mqudsi committed Feb 5, 2021
1 parent c115c3c commit f833593
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf.swap_remove_front(2), Some(3));
/// assert_eq!(buf, [2, 1]);
/// ```
#[doc(alias = "swap_take_front")]
#[stable(feature = "deque_extras_15", since = "1.5.0")]
pub fn swap_remove_front(&mut self, index: usize) -> Option<T> {
let length = self.len();
Expand Down Expand Up @@ -1527,6 +1528,7 @@ impl<T> VecDeque<T> {
/// assert_eq!(buf.swap_remove_back(0), Some(1));
/// assert_eq!(buf, [3, 2]);
/// ```
#[doc(alias = "swap_take_back")]
#[stable(feature = "deque_extras_15", since = "1.5.0")]
pub fn swap_remove_back(&mut self, index: usize) -> Option<T> {
let length = self.len();
Expand Down
1 change: 1 addition & 0 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// assert_eq!(v, ["baz", "qux"]);
/// ```
#[inline]
#[doc(alias = "swap_take")]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn swap_remove(&mut self, index: usize) -> T {
#[cold]
Expand Down

0 comments on commit f833593

Please sign in to comment.