Skip to content

Commit a015b2d

Browse files
authored
safety lint in bevy_reflect on wasm (#22174)
# Objective - `cargo clippy --target wasm32-unknown-unknown -p bevy_reflect --no-deps -- -D warnings` fail with ``` error: unsafe block missing a safety comment --> crates/bevy_reflect/src/lib.rs:804:21 | 804 | unsafe { | ^^^^^^^^ | ``` ## Solution - Change the order between the lint and the safety comment
1 parent 1e87589 commit a015b2d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/bevy_reflect/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,14 +793,14 @@ pub mod __macro_exports {
793793
if INIT_DONE.swap(true, Ordering::Relaxed) {
794794
return;
795795
};
796-
// SAFETY:
797-
// This will call constructors on wasm platforms at most once (as long as `init` is the only function that calls `__wasm_call_ctors`).
798-
//
799-
// For more information see: https://docs.rs/inventory/latest/inventory/#webassembly-and-constructors
800796
#[expect(
801797
unsafe_code,
802798
reason = "This function must be called to use inventory on wasm."
803799
)]
800+
// SAFETY:
801+
// This will call constructors on wasm platforms at most once (as long as `init` is the only function that calls `__wasm_call_ctors`).
802+
//
803+
// For more information see: https://docs.rs/inventory/latest/inventory/#webassembly-and-constructors
804804
unsafe {
805805
__wasm_call_ctors();
806806
}

0 commit comments

Comments
 (0)