Skip to content

Commit be8ff5d

Browse files
authored
Extract common wireframe filters in type alias (#10080)
# Objective - The filter type on the `apply_global_wireframe_material` system had duplicate filter code and the `clippy::type_complexity` attribute. ## Solution - Extract the common part of the filter into a type alias
1 parent f8cbc73 commit be8ff5d

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

crates/bevy_pbr/src/wireframe.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,14 @@ fn apply_wireframe_material(
108108
commands.insert_or_spawn_batch(wireframes_to_spawn);
109109
}
110110

111+
type WireframeFilter = (With<Handle<Mesh>>, Without<Wireframe>, Without<NoWireframe>);
112+
111113
/// Applies or removes a wireframe material on any mesh without a [`Wireframe`] component.
112-
#[allow(clippy::type_complexity)]
113114
fn apply_global_wireframe_material(
114115
mut commands: Commands,
115116
config: Res<WireframeConfig>,
116-
meshes_without_material: Query<
117-
Entity,
118-
(
119-
With<Handle<Mesh>>,
120-
Without<Wireframe>,
121-
Without<NoWireframe>,
122-
Without<Handle<WireframeMaterial>>,
123-
),
124-
>,
125-
meshes_with_global_material: Query<
126-
Entity,
127-
(
128-
With<Handle<Mesh>>,
129-
Without<Wireframe>,
130-
Without<NoWireframe>,
131-
With<Handle<WireframeMaterial>>,
132-
),
133-
>,
117+
meshes_without_material: Query<Entity, (WireframeFilter, Without<Handle<WireframeMaterial>>)>,
118+
meshes_with_global_material: Query<Entity, (WireframeFilter, With<Handle<WireframeMaterial>>)>,
134119
global_material: Res<GlobalWireframeMaterial>,
135120
) {
136121
if !config.is_changed() {

0 commit comments

Comments
 (0)