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
```
This commit is contained in:
François Mockers 2025-06-29 23:30:28 +02:00 committed by GitHub
parent a98b5683ae
commit 764be9199c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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::<web_sys::HtmlCanvasElement>().ok();
winit_window_attributes = winit_window_attributes.with_canvas(canvas);
} else {
panic!("Cannot find element: {}.", selector);
panic!("Cannot find element: {selector}.");
}
}