render: resolve clippy warnings in BlackHolePlugin systems

Fixes the following clippy warnings in plugin.rs:
1. clippy::too_many_arguments: Suppressed on spawn_fullscreen_quad since Bevy system functions naturally take many arguments as resources/queries.
2. clippy::field_reassign_with_default: Refactored instantiation of BlackHoleMaterial to set fields in the struct literal instead of post-creation assignment.
3. clippy::type_complexity: Suppressed on resize_offscreen and nudge_camera systems as Bevy queries with Filters/Disjunctions are inherently complex.
This commit is contained in:
xfy 2026-07-14 15:09:39 +08:00
parent 17fbbf98e1
commit 9afab04308

View File

@ -61,6 +61,7 @@ impl Plugin for BlackHolePlugin {
} }
} }
#[allow(clippy::too_many_arguments)]
fn spawn_fullscreen_quad( fn spawn_fullscreen_quad(
mut commands: Commands, mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>, mut meshes: ResMut<Assets<Mesh>>,
@ -103,8 +104,10 @@ fn spawn_fullscreen_quad(
super::material::SphereData::default(); super::material::SphereData::default();
super::material::MAX_PLANETS super::material::MAX_PLANETS
])); ]));
let mut material = BlackHoleMaterial::default(); let material = BlackHoleMaterial {
material.planets = planets_buffer; planets: planets_buffer,
..Default::default()
};
commands.spawn(( commands.spawn((
Mesh2d(meshes.add(Rectangle::new(2.0, 2.0))), Mesh2d(meshes.add(Rectangle::new(2.0, 2.0))),
MeshMaterial2d(materials.add(material)), MeshMaterial2d(materials.add(material)),
@ -141,6 +144,7 @@ fn spawn_fullscreen_quad(
/// Recreate the offscreen Image and rescale both quads on window resize, /// Recreate the offscreen Image and rescale both quads on window resize,
/// honoring the live `render_scale` param. /// honoring the live `render_scale` param.
#[allow(clippy::type_complexity)]
fn resize_offscreen( fn resize_offscreen(
mut images: ResMut<Assets<Image>>, mut images: ResMut<Assets<Image>>,
params: Res<crate::params::BlackHoleParams>, params: Res<crate::params::BlackHoleParams>,
@ -185,6 +189,7 @@ fn resize_offscreen(
/// entity — its freeze would make the upscale camera re-sample a stale /// entity — its freeze would make the upscale camera re-sample a stale
/// texture every frame → frozen view) and the upscale camera (the one /// texture every frame → frozen view) and the upscale camera (the one
/// rendering to the window). Remove when the upstream regression is fixed. /// rendering to the window). Remove when the upstream regression is fixed.
#[allow(clippy::type_complexity)]
fn nudge_camera( fn nudge_camera(
time: Res<Time>, time: Res<Time>,
mut camera: Query<&mut Transform, Or<(With<OffscreenCamera>, With<UpscaleCamera>)>>, mut camera: Query<&mut Transform, Or<(With<OffscreenCamera>, With<UpscaleCamera>)>>,