You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checks for the usage of &expr as *const T or &mut expr as *mut T, and suggest using ptr::addr_of or ptr::addr_of_mut instead.
This would improve readability and avoid creating an unsafe reference that points to an uninitialized value or unaligned place. See also addr_of.
Categories (optional)
correctness or style
Drawbacks
None.
Example
let val = 1;let p = &val as*consti32;letmut val_mut = 1;let p_mut = &mut val_mut as*muti32;
Could be written as:
let val = 1;let p = ptr::addr_of!(val);letmut val_mut = 1;let p_mut = ptr::addr_of_mut!(val_mut);
MSRV
1.51.0
The text was updated successfully, but these errors were encountered:
What it does
Checks for the usage of
&expr as *const T
or&mut expr as *mut T
, and suggest usingptr::addr_of
orptr::addr_of_mut
instead.This would improve readability and avoid creating an unsafe reference that points to an uninitialized value or unaligned place. See also addr_of.
Categories (optional)
correctness
orstyle
Drawbacks
None.
Example
Could be written as:
MSRV
1.51.0
The text was updated successfully, but these errors were encountered: