Skip to content

Commit 3d42c6d

Browse files
author
bors-servo
authored
Auto merge of #74 - mbrubeck:veclike, r=jdm
Deprecate the VecLike trait This is an update of PR #35. This trait is redundant with existing traits like `Extend` and `Deref`. Its purpose is unclear (you can do a few things with it, but not much) and the one use case I know of has been removed (servo/servo#19424). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/74) <!-- Reviewable:end -->
2 parents 8f3198c + eefbdfa commit 3d42c6d

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
}
@@ -897,6 +899,7 @@ impl<A: Array> ExtendFromSlice<A::Item> for SmallVec<A> where A::Item: Copy {
897899
}
898900
}
899901

902+
#[allow(deprecated)]
900903
impl<A: Array> VecLike<A::Item> for SmallVec<A> {
901904
#[inline]
902905
fn push(&mut self, value: A::Item) {
@@ -1626,6 +1629,7 @@ pub mod tests {
16261629
}
16271630

16281631
#[test]
1632+
#[allow(deprecated)]
16291633
fn veclike_deref_slice() {
16301634
use super::VecLike;
16311635

0 commit comments

Comments
 (0)