Skip to content

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

Closed
wants to merge 2 commits into from
Closed

std: clean up ptr a bit #12282

wants to merge 2 commits into from

Conversation

emberian
Copy link
Member

No description provided.

*/
#[inline(always)]
pub unsafe fn read_ptr<T>(src: *T) -> T {
pub unsafe fn read<T>(src: *T) -> T {
Copy link
Member

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for RawPtr::read()

Copy link
Member Author

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.

@huonw
Copy link
Member

huonw commented Feb 15, 2014

r=me with the import in the right spot

bors added a commit that referenced this pull request Feb 15, 2014
@bors bors closed this Feb 15, 2014
chris-morgan added a commit to chris-morgan/ncurses-rs that referenced this pull request Feb 16, 2014
jeaye pushed a commit to jeaye/ncurses-rs that referenced this pull request Feb 16, 2014
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants