Skip to content

Commit 2849ab8

Browse files
Use 1.79 stabilized api to remove use of unsafe
1 parent e36e665 commit 2849ab8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/storage.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ impl Storage for ViewStorage {}
5353
impl SealedStorage for ViewStorage {
5454
type Buffer<T> = [T];
5555
fn len<T>(this: *const Self::Buffer<T>) -> usize {
56-
// We get the len of the buffer. There is no reverse method of `core::ptr::from_raw_parts`, so we have to work around it.
57-
let ptr: *const [()] = this as _;
58-
// SAFETY: There is no aliasing as () is zero-sized
59-
let slice: &[()] = unsafe { &*ptr };
60-
let len = slice.len();
61-
62-
len - 1
56+
this.len()
6357
}
6458

6559
fn as_ptr<T>(this: *mut Self::Buffer<T>) -> *mut T {

0 commit comments

Comments
 (0)