Skip to content

Commit fe14497

Browse files
committed
fix alignment issue
Signed-off-by: Connor Tsui <[email protected]>
1 parent 97afaef commit fe14497

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

vortex-buffer/src/buffer.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::hash::{Hash, Hasher};
99
use std::marker::PhantomData;
1010
use std::ops::{Deref, RangeBounds};
1111

12-
use bytes::{Buf, Bytes, BytesMut};
12+
use bytes::{Buf, Bytes};
1313
use vortex_error::{VortexExpect, vortex_panic};
1414

1515
use crate::debug::TruncatedDebug;
@@ -419,14 +419,8 @@ impl<T> Buffer<T> {
419419

420420
/// Convert self into `BufferMut<T>`, cloning the data if there are multiple strong references.
421421
pub fn into_mut(self) -> BufferMut<T> {
422-
let new_bytes = self.bytes.try_into_mut().unwrap_or_else(BytesMut::from);
423-
424-
BufferMut {
425-
bytes: new_bytes,
426-
length: self.length,
427-
alignment: self.alignment,
428-
_marker: Default::default(),
429-
}
422+
self.try_into_mut()
423+
.unwrap_or_else(|buffer| BufferMut::<T>::copy_from(&buffer))
430424
}
431425

432426
/// Returns whether a `Buffer<T>` is aligned to the given alignment.

0 commit comments

Comments
 (0)