1
Fork 0

Make use of [wrapping_]byte_{add,sub}

...replacing `.cast().wrapping_offset().cast()` & similar code.
This commit is contained in:
Maybe Waffle 2022-08-19 13:20:22 +04:00
parent 1cff564203
commit 53565b23ac
10 changed files with 17 additions and 18 deletions

View file

@ -255,7 +255,7 @@ impl<T: ?Sized> *mut T {
let offset = dest_addr.wrapping_sub(self_addr);
// This is the canonical desugarring of this operation
self.cast::<u8>().wrapping_offset(offset).cast::<T>()
self.wrapping_byte_offset(offset)
}
/// Creates a new pointer by mapping `self`'s address to a new one.