From 9d007211337cb23349110535e6d2d2cbb0341822 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Sat, 5 Oct 2019 00:05:04 +0200 Subject: [PATCH] Remove VecLike (#165) This is a backwards incompatible change. VecLike was deprecated in 0.6.0 released 2 years ago, and that should have given plenty of time to remove its usages. --- lib.rs | 73 ---------------------------------------------------------- 1 file changed, 73 deletions(-) diff --git a/lib.rs b/lib.rs index e6dfcba..459c207 100644 --- a/lib.rs +++ b/lib.rs @@ -142,54 +142,6 @@ macro_rules! debug_unreachable { }; } -/// Common operations implemented by both `Vec` and `SmallVec`. -/// -/// This can be used to write generic code that works with both `Vec` and `SmallVec`. -/// -/// ## Example -/// -/// ```rust -/// use smallvec::{VecLike, SmallVec}; -/// -/// fn initialize>(v: &mut V) { -/// for i in 0..5 { -/// v.push(i); -/// } -/// } -/// -/// let mut vec = Vec::new(); -/// initialize(&mut vec); -/// -/// let mut small_vec = SmallVec::<[u8; 8]>::new(); -/// initialize(&mut small_vec); -/// ``` -#[deprecated(note = "Use `Extend` and `Deref<[T]>` instead")] -pub trait VecLike: - ops::Index - + ops::IndexMut - + ops::Index, Output = [T]> - + ops::IndexMut> - + ops::Index, Output = [T]> - + ops::IndexMut> - + ops::Index, Output = [T]> - + ops::IndexMut> - + ops::Index - + ops::IndexMut - + ops::DerefMut - + Extend -{ - /// Append an element to the vector. - fn push(&mut self, value: T); -} - -#[allow(deprecated)] -impl VecLike for Vec { - #[inline] - fn push(&mut self, value: T) { - Vec::push(self, value); - } -} - /// Trait to be implemented by a collection that can be extended from a slice /// /// ## Example @@ -1357,14 +1309,6 @@ where } } -#[allow(deprecated)] -impl VecLike for SmallVec { - #[inline] - fn push(&mut self, value: A::Item) { - SmallVec::push(self, value); - } -} - impl FromIterator for SmallVec { fn from_iter>(iterable: I) -> SmallVec { let mut v = SmallVec::new(); @@ -2227,23 +2171,6 @@ mod tests { assert_eq!(vec.drain().len(), 3); } - #[test] - #[allow(deprecated)] - fn veclike_deref_slice() { - use super::VecLike; - - fn test>(vec: &mut T) { - assert!(!vec.is_empty()); - assert_eq!(vec.len(), 3); - - vec.sort(); - assert_eq!(&vec[..], [1, 2, 3]); - } - - let mut vec = SmallVec::<[i32; 2]>::from(&[3, 1, 2][..]); - test(&mut vec); - } - #[test] fn shrink_to_fit_unspill() { let mut vec = SmallVec::<[u8; 2]>::from_iter(0..3);