Make use of [wrapping_]byte_{add,sub}
...replacing `.cast().wrapping_offset().cast()` & similar code.
This commit is contained in:
parent
1cff564203
commit
53565b23ac
10 changed files with 17 additions and 18 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue