From 1bfe8845d5effac738fbc02624f65a81700329ce Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Sat, 10 Aug 2024 12:36:04 +0200 Subject: [PATCH] ignore 'arc instead of rc' warnings on wasm --- wgpu-core/src/instance.rs | 1 - wgpu-core/src/lib.rs | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 8c7585be9..a71117cfe 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -495,7 +495,6 @@ impl Global { surface_per_backend, }; - #[allow(clippy::arc_with_non_send_sync)] let id = self .surfaces .prepare(wgt::Backend::Empty, id_in) // No specific backend for Surface, since it's not specific. diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 179664490..9b27d64a7 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -62,6 +62,13 @@ the documentation for `wgpu-core` is empty unless built with unused_extern_crates, unused_qualifications )] +// We use `Arc` in wgpu-core, but on wasm (unless opted out via `fragile-send-sync-non-atomic-wasm`) +// wgpu-hal resources are not Send/Sync, causing a clippy warning for unnecessary `Arc`s. +// We could use `Rc`s in this case as recommended, but unless atomics are enabled +// this doesn't make a difference. +// Therefore, this is only really a concern for users targeting WebGL +// (the only reason to use wgpu-core on the web in the first place) that have atomics enabled. +#![cfg_attr(not(send_sync), allow(clippy::arc_with_non_send_sync))] pub mod binding_model; pub mod command;