File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -821,16 +821,16 @@ impl<A: Array> SmallVec<A> {
821821 }
822822 }
823823
824- pub fn into_inner ( mut self ) -> Result < A , Self > {
825824 /// Convert the SmallVec into an `A` if possible. Otherwise return `Err(Self)`.
826825 ///
827826 /// This method returns `Err(Self)` if the SmallVec is too short (and the `A` contains uninitialized elements),
828827 /// or if the SmallVec is too long (and all the elements were spilled to the heap).
828+ pub fn into_inner ( self ) -> Result < A , Self > {
829829 if self . spilled ( ) || self . len ( ) != A :: size ( ) {
830830 Err ( self )
831831 } else {
832832 unsafe {
833- let data = mem :: replace ( & mut self . data , SmallVecData :: from_inline ( mem :: uninitialized ( ) ) ) ;
833+ let data = ptr :: read ( & self . data ) ;
834834 mem:: forget ( self ) ;
835835 Ok ( data. into_inline ( ) )
836836 }
You can’t perform that action at this time.
0 commit comments