We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e36e665 commit 2849ab8Copy full SHA for 2849ab8
src/storage.rs
@@ -53,13 +53,7 @@ impl Storage for ViewStorage {}
53
impl SealedStorage for ViewStorage {
54
type Buffer<T> = [T];
55
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
+ this.len()
63
}
64
65
fn as_ptr<T>(this: *mut Self::Buffer<T>) -> *mut T {
0 commit comments