Skip to content
4 changes: 2 additions & 2 deletions src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<Item: Clone, const INLINE: usize> From<&[Item]> for SmallVec<Item, INLINE,
fn from(slice: &[Item]) -> Self {
if slice.len() > Self::inline_size() {
// Standard Rust vectors are already specialized.
Self::from_vec(Vec::from(slice))
Vec::from(slice).into()
} else {
// SAFETY: The precondition is checked in the initial comparison
// above.
Expand Down Expand Up @@ -153,6 +153,6 @@ impl<Item, const INLINE: usize, Heap: Allocator> From<SmallVec<Item, INLINE, Hea

impl<T, const N: usize> From<Box<[T]>> for SmallVec<T, N> {
fn from(boxed: Box<[T]>) -> Self {
Self::from_vec(boxed.into_vec())
boxed.into_vec().into()
}
}
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ impl<Item, const INLINE: usize> SmallVec<Item, INLINE, Global> {
}

#[inline]
#[deprecated(since = "2.0.0-beta.3", note = "use `From::<Vec<T>>::from` instead")]
pub fn from_vec(vec: Vec<Item>) -> Self {
if vec.capacity() == 0 {
return Self::new();
Expand Down Expand Up @@ -1524,7 +1525,7 @@ pub fn from_elem<Item: Clone, const INLINE: usize>(
) -> SmallVec<Item, INLINE, Global> {
if n > SmallVec::<Item, INLINE>::inline_size() {
// Standard Rust vectors are already specialized.
SmallVec::from_vec(vec![elem; n])
vec![elem; n].into()
} else {
#[cfg(feature = "specialization")]
{
Expand Down
Loading