diff --git a/src/conversions.rs b/src/conversions.rs index de5a5230..0c4579f4 100644 --- a/src/conversions.rs +++ b/src/conversions.rs @@ -17,7 +17,7 @@ impl From<&[Item]> for SmallVec 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. @@ -153,6 +153,6 @@ impl From From> for SmallVec { fn from(boxed: Box<[T]>) -> Self { - Self::from_vec(boxed.into_vec()) + boxed.into_vec().into() } } diff --git a/src/lib.rs b/src/lib.rs index dbd6390f..b829e233 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -228,6 +228,7 @@ impl SmallVec { } #[inline] + #[deprecated(since = "2.0.0-beta.3", note = "use `From::>::from` instead")] pub fn from_vec(vec: Vec) -> Self { if vec.capacity() == 0 { return Self::new(); @@ -1524,7 +1525,7 @@ pub fn from_elem( ) -> SmallVec { if n > SmallVec::::inline_size() { // Standard Rust vectors are already specialized. - SmallVec::from_vec(vec![elem; n]) + vec![elem; n].into() } else { #[cfg(feature = "specialization")] {