Skip to content

Commit 1e87589

Browse files
authored
fix unused warnings in bevy_dev_tools on wasm (#22175)
# Objective - After #21885, FPS overlay has some unused warnings when building for wasm without webgpu ## Solution - Fix them
1 parent 271c764 commit 1e87589

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

crates/bevy_dev_tools/src/fps_overlay.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ use bevy_ui::{
2020
widget::{Text, TextUiWriter},
2121
FlexDirection, GlobalZIndex, Node, PositionType, Val,
2222
};
23+
#[cfg(not(all(target_arch = "wasm32", not(feature = "webgpu"))))]
2324
use bevy_ui_render::prelude::MaterialNode;
2425
use core::time::Duration;
2526
use tracing::warn;
2627

27-
use crate::frame_time_graph::{
28-
FrameTimeGraphConfigUniform, FrameTimeGraphPlugin, FrametimeGraphMaterial,
29-
};
28+
#[cfg(not(all(target_arch = "wasm32", not(feature = "webgpu"))))]
29+
use crate::frame_time_graph::FrameTimeGraphConfigUniform;
30+
use crate::frame_time_graph::{FrameTimeGraphPlugin, FrametimeGraphMaterial};
3031

3132
/// [`GlobalZIndex`] used to render the fps overlay.
3233
///
@@ -163,8 +164,14 @@ struct FrameTimeGraph;
163164
fn setup(
164165
mut commands: Commands,
165166
overlay_config: Res<FpsOverlayConfig>,
166-
mut frame_time_graph_materials: ResMut<Assets<FrametimeGraphMaterial>>,
167-
mut buffers: ResMut<Assets<ShaderStorageBuffer>>,
167+
#[cfg_attr(
168+
all(target_arch = "wasm32", not(feature = "webgpu")),
169+
expect(unused, reason = "Unused variables in wasm32 without webgpu feature")
170+
)]
171+
(mut frame_time_graph_materials, mut buffers): (
172+
ResMut<Assets<FrametimeGraphMaterial>>,
173+
ResMut<Assets<ShaderStorageBuffer>>,
174+
),
168175
) {
169176
commands
170177
.spawn((

0 commit comments

Comments
 (0)