-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std: clean up ptr a bit #12282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std: clean up ptr a bit #12282
Conversation
*/ | ||
#[inline(always)] | ||
pub unsafe fn read_ptr<T>(src: *T) -> T { | ||
pub unsafe fn read<T>(src: *T) -> T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason these can't be methods on RawPtr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for RawPtr::read()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Reproduced here)
Changing ptr::read to RawPtr::read is extremely inconvenient because, with ptr::read, &T
will be coerced, whereas it will not be when it is a method. This introduces quite unnecessary casts. I do not wish to change it.
r=me with the import in the right spot |
Remove to_unsafe_ptr usage (rust-lang/rust#12282).
Handle false positive with `map_clone` lint ### Summary - Fixes rust-lang/rust-clippy#12271 - (This is my first contribution to clippy and any suggestion would be appreciated) changelog: [`map_clone`]: Handle false positive with `map_clone` lint
No description provided.