Skip to content
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

ref_as_ptr example does not emit warnings #12771

Open
y21 opened this issue May 6, 2024 · 1 comment
Open

ref_as_ptr example does not emit warnings #12771

y21 opened this issue May 6, 2024 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@y21
Copy link
Member

y21 commented May 6, 2024

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
@y21 y21 added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels May 6, 2024
@J-ZhengLi
Copy link
Member

related PR: #12260

the doc should be updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

2 participants