-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Enable clippy::ref_as_ptr
#12918
Enable clippy::ref_as_ptr
#12918
Conversation
I chose to ignore the lint in `bevy_mikktspace`, since it needs a refactor and I'd rather not touch it.
@tguichaoua, would you mind reviewing? |
I'm honestly unsure why CI is failing. It's definitely running Rust 1.77.2. I'm probably going to just fix the lint instead of digging into this further. error: unknown lint: `clippy::ref_as_ptr`
--> crates/bevy_mikktspace/src/lib.rs:6:5
|
6 | clippy::ref_as_ptr
| ^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::ptr_as_ptr`
|
= note: `-D unknown-lints` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unknown_lints)]` |
CI was raising an error about `ref_as_ptr` being an unknown lint. Instead of trying to figure out what was going on, I instead opted to just fix the lint.
|
Well that explains why I was getting this error earlier. I'm surprised CI doesn't complain about it in Unless it's giving someone issues locally, I think this can probably be kept. |
Objective
clippy::ref_as_ptr
prevents you from directly casting references to pointers, requiring you to usestd::ptr::from_ref
instead. This prevents you from accidentally converting an immutable reference into a mutable pointer (&x as *mut T
).as
) by their API equivalent #11818, now that ourrust-version
is 1.77.Solution