rust-lang / rust-lang/rust-clippy
`ref_as_ptr` example does not emit warnings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
The example in https://rust-lang.github.io/rust-clippy/master/index.html#/ref_as_ptr does not emit any warnings for the lint.
Lint Name
ref_as_ptr
Reproducer
I tried this code:
#![warn(clippy::ref_as_ptr)]
fn main() {
let a_ref = &1i32;
let a_ptr = a_ref as *const _;
}
I expected to see this happen:
Since this is the example for what not to do, the lint should emit a warning here suggesting to use ptr::from_ref.
Instead, this happened:
No warnings.
Version
clippy commit befb659145a734e51a3708ff84315ae07123c880
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
Start with the ref_as_ptr lint entry point and its documentation example at the linked Clippy book page, then run the supplied Rust reproducer with the lint enabled. Compare the example with the lint's existing tests or diagnostics; done means the example triggers a warning recommending ptr::from_ref.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100