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

Enable clippy::ref_as_ptr #12918

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ semicolon_if_nothing_returned = "warn"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
#TODO(rust 1.77): enable `ref_as_ptr`
# ref_as_ptr = "warn"
ref_as_ptr = "warn"

[workspace.lints.rust]
unsafe_op_in_unsafe_fn = "warn"
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_mikktspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
unsafe_op_in_unsafe_fn,
clippy::all,
clippy::undocumented_unsafe_blocks,
clippy::ptr_cast_constness
clippy::ptr_cast_constness,
clippy::ref_as_ptr
)]
// FIXME(3492): remove once docs are ready
#![allow(missing_docs)]
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_render/src/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ impl Eq for MeshVertexBufferLayoutRef {}

impl Hash for MeshVertexBufferLayoutRef {
fn hash<H: Hasher>(&self, state: &mut H) {
(&*self.0 as *const MeshVertexBufferLayout as usize).hash(state);
// Hash the address of the underlying data, so two layouts that share the same
// `MeshVertexBufferLayout` will have the same hash.
(Arc::as_ptr(&self.0) as usize).hash(state);
}
}
Loading