Skip to content

ref_as_ptr example does not emit warnings #12771

Open
@y21

Description

@y21

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions