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> {
821
821
}
822
822
}
823
823
824
- pub fn into_inner ( mut self ) -> Result < A , Self > {
825
824
/// Convert the SmallVec into an `A` if possible. Otherwise return `Err(Self)`.
826
825
///
827
826
/// This method returns `Err(Self)` if the SmallVec is too short (and the `A` contains uninitialized elements),
828
827
/// 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 > {
829
829
if self . spilled ( ) || self . len ( ) != A :: size ( ) {
830
830
Err ( self )
831
831
} else {
832
832
unsafe {
833
- let data = mem :: replace ( & mut self . data , SmallVecData :: from_inline ( mem :: uninitialized ( ) ) ) ;
833
+ let data = ptr :: read ( & self . data ) ;
834
834
mem:: forget ( self ) ;
835
835
Ok ( data. into_inline ( ) )
836
836
}
You can’t perform that action at this time.
0 commit comments