From 764be9199c8879ccf20cdfcf4dc35f0541006c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sun, 29 Jun 2025 23:30:28 +0200 Subject: [PATCH] bevy_winit: fix compile and clippy on wasm (#19869) # Objective - bevy_winit has a warning when compiling without default feature on linux - bevy_winit has a clippy warning when compiling in wasm ## Solution - Fix them ## Testing ``` cargo build -p bevy_winit --no-default-features --features winit/x11 cargo clippy --target wasm32-unknown-unknown -p bevy_winit --no-deps -- -D warnings ``` --- crates/bevy_winit/src/winit_windows.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index f238da2e20..8cc5dcfac7 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -190,11 +190,16 @@ impl WinitWindows { bevy_log::debug!("{display_info}"); #[cfg(any( - target_os = "linux", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd", + all( + any(feature = "wayland", feature = "x11"), + any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd", + ) + ), target_os = "windows" ))] if let Some(name) = &window.name { @@ -285,7 +290,7 @@ impl WinitWindows { let canvas = canvas.dyn_into::().ok(); winit_window_attributes = winit_window_attributes.with_canvas(canvas); } else { - panic!("Cannot find element: {}.", selector); + panic!("Cannot find element: {selector}."); } }