Skip to content

Commit eefbdfa

Browse files
committed
Deprecate the VecLike trait
This trait is redundant with existing traits like `Extend` and `Deref`.
1 parent eee285e commit eefbdfa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ use SmallVecData::{Inline, Heap};
7575
/// let mut small_vec = SmallVec8::new();
7676
/// initialize(&mut small_vec);
7777
/// ```
78+
#[deprecated(note = "Use `Extend` and `Deref<[T]>` instead")]
7879
pub trait VecLike<T>:
7980
ops::Index<usize, Output=T> +
8081
ops::IndexMut<usize> +
@@ -93,6 +94,7 @@ pub trait VecLike<T>:
9394
fn push(&mut self, value: T);
9495
}
9596

97+
#[allow(deprecated)]
9698
impl<T> VecLike<T> for Vec<T> {
9799
#[inline]
98100
fn push(&mut self, value: T) {
@@ -119,7 +121,7 @@ impl<T> VecLike<T> for Vec<T> {
119121
/// initialize(&mut small_vec);
120122
/// assert_eq!(&small_vec as &[_], b"Test!");
121123
/// ```
122-
pub trait ExtendFromSlice<T>: VecLike<T> {
124+
pub trait ExtendFromSlice<T> {
123125
/// Extends a collection from a slice of its element type
124126
fn extend_from_slice(&mut self, other: &[T]);
125127
}
@@ -853,6 +855,7 @@ impl<A: Array> ExtendFromSlice<A::Item> for SmallVec<A> where A::Item: Copy {
853855
}
854856
}
855857

858+
#[allow(deprecated)]
856859
impl<A: Array> VecLike<A::Item> for SmallVec<A> {
857860
#[inline]
858861
fn push(&mut self, value: A::Item) {
@@ -1582,6 +1585,7 @@ pub mod tests {
15821585
}
15831586

15841587
#[test]
1588+
#[allow(deprecated)]
15851589
fn veclike_deref_slice() {
15861590
use super::VecLike;
15871591

0 commit comments

Comments
 (0)