From eefbdfae69689c221fb69fb2214bc7739413c59f Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 29 Nov 2017 09:39:24 -0800 Subject: [PATCH] Deprecate the VecLike trait This trait is redundant with existing traits like `Extend` and `Deref`. --- lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index 3cfa797..628dabe 100644 --- a/lib.rs +++ b/lib.rs @@ -75,6 +75,7 @@ use SmallVecData::{Inline, Heap}; /// let mut small_vec = SmallVec8::new(); /// initialize(&mut small_vec); /// ``` +#[deprecated(note = "Use `Extend` and `Deref<[T]>` instead")] pub trait VecLike: ops::Index + ops::IndexMut + @@ -93,6 +94,7 @@ pub trait VecLike: fn push(&mut self, value: T); } +#[allow(deprecated)] impl VecLike for Vec { #[inline] fn push(&mut self, value: T) { @@ -119,7 +121,7 @@ impl VecLike for Vec { /// initialize(&mut small_vec); /// assert_eq!(&small_vec as &[_], b"Test!"); /// ``` -pub trait ExtendFromSlice: VecLike { +pub trait ExtendFromSlice { /// Extends a collection from a slice of its element type fn extend_from_slice(&mut self, other: &[T]); } @@ -853,6 +855,7 @@ impl ExtendFromSlice for SmallVec where A::Item: Copy { } } +#[allow(deprecated)] impl VecLike for SmallVec { #[inline] fn push(&mut self, value: A::Item) { @@ -1582,6 +1585,7 @@ pub mod tests { } #[test] + #[allow(deprecated)] fn veclike_deref_slice() { use super::VecLike;