rust-lang / rust-lang/rust-clippy
Lint for `addr_of` -> `&raw const` and `addr_of_mut` -> `&raw mut`
Open
Nobody has claimed this yet.
A-lint
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
As per title, for projects with MSRV 1.82 or higher:
- Suggest replacing
addr_of!(x)with&raw const x - Suggest replacing
addr_of_mut!(x)with&raw mut x
Advantage
The macros are documented as soft-deprecated; seems like encouraging use of the operators would fit that recommendation.
Drawbacks
No response
Example
addr_of!(x);
addr_of_mut!(y);
Could be written as:
&raw const x;
&raw mut y;
Comparison with existing lints
No response
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating existing Clippy lints for addr_of! and addr_of_mut!, then inspect their lint tests and MSRV handling. Done means projects with MSRV 1.82 or higher receive suggestions for the corresponding &raw const or &raw mut syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100