Skip to content

Commit

Permalink
remove unstable deprecated Vec::remove_item
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 13, 2021
1 parent da305a2 commit 7e83fec
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,27 +1950,6 @@ impl<T: PartialEq, A: Allocator> Vec<T, A> {
}
}

impl<T, A: Allocator> Vec<T, A> {
/// Removes the first instance of `item` from the vector if the item exists.
///
/// This method will be removed soon.
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")]
#[rustc_deprecated(
reason = "Removing the first item equal to a needle is already easily possible \
with iterators and the current Vec methods. Furthermore, having a method for \
one particular case of removal (linear search, only the first item, no swap remove) \
but not for others is inconsistent. This method will be removed soon.",
since = "1.46.0"
)]
pub fn remove_item<V>(&mut self, item: &V) -> Option<T>
where
T: PartialEq<V>,
{
let pos = self.iter().position(|x| *x == *item)?;
Some(self.remove(pos))
}
}

////////////////////////////////////////////////////////////////////////////////
// Internal methods and functions
////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7e83fec

Please sign in to comment.