Skip to content

Commit 4959548

Browse files
committed
For review
1 parent fe54f67 commit 4959548

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

arrow-buffer/src/buffer/immutable.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,9 @@ impl Buffer {
7474
/// Returns the offset, in bytes, of `Self::ptr` to `Self::data`
7575
///
7676
/// self.ptr and self.data can be different after slicing or advancing the buffer.
77-
///
78-
/// # Safety
79-
///
80-
/// This function is unsafe as it uses unsafe function `offset_from`. Under certain
81-
/// conditions, this function can cause undefined behavior. See the documentation of
82-
/// `offset_from` for more information.
83-
pub unsafe fn ptr_offset(&self) -> usize {
84-
self.ptr.offset_from(self.data.ptr().as_ptr()) as usize
77+
pub fn ptr_offset(&self) -> usize {
78+
// Safety: `ptr` is always in bounds of `data`.
79+
unsafe { self.ptr.offset_from(self.data.ptr().as_ptr()) as usize }
8580
}
8681

8782
/// Returns the pointer to the start of the buffer without the offset.

0 commit comments

Comments
 (0)