diff options
| author | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2020-06-20 11:09:53 +0200 |
|---|---|---|
| committer | Lukas Kalbertodt <lukas.kalbertodt@gmail.com> | 2020-06-20 11:09:53 +0200 |
| commit | ef10694d3bd593164e9a16829a9148e9cc335ced (patch) | |
| tree | 2f35c86f5916c0ba414dc53a6966ebeaabc9eb72 /src/liballoc | |
| parent | 033013cab3a861224fd55f494c8be1cb0349eb49 (diff) | |
| download | rust-ef10694d3bd593164e9a16829a9148e9cc335ced.tar.gz rust-ef10694d3bd593164e9a16829a9148e9cc335ced.zip | |
Deprecate `Vec::remove_item`
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 95c3b3b1861..0531084d0e4 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1760,17 +1760,15 @@ impl<T: PartialEq> Vec<T> { impl<T> Vec<T> { /// Removes the first instance of `item` from the vector if the item exists. /// - /// # Examples - /// - /// ``` - /// # #![feature(vec_remove_item)] - /// let mut vec = vec![1, 2, 3, 1]; - /// - /// vec.remove_item(&1); - /// - /// assert_eq!(vec, vec![2, 3, 1]); - /// ``` + /// 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>, |
