fix(simulation): Clippy cleanup and CI enforcement (#635)

Fix all Clippy warnings across the server codebase (2411 insertions, 1341
deletions). Raise type-complexity-threshold to 750 and too-many-arguments
to 12 in .clippy.toml for idiomatic Bevy ECS system signatures. The server
now passes `cargo clippy -- --deny warnings` cleanly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-17 10:33:15 +01:00
co-authored by Claude Opus 4.6
parent 7f7706442a
commit aa79dd97e7
84 changed files with 2409 additions and 1339 deletions
+4 -3
View File
@@ -17,7 +17,9 @@
use bevy_app::prelude::*;
use crate::knowledge::registry::{EntityRegistry, StableEntityId};
use crate::npc::{Contentment, DailyRoutine, Npc, RoutineEntry, ToleranceThreshold, Want, WantKind};
use crate::npc::{
Contentment, DailyRoutine, Npc, RoutineEntry, ToleranceThreshold, Want, WantKind,
};
use crate::simulation::interaction::Interactable;
use crate::simulation::movement::TilePosition;
use crate::simulation::path_follow::MovementSpeed;
@@ -177,8 +179,7 @@ mod tests {
.id();
// Advance time to Afternoon boundary (Morning→Afternoon).
world.resource_mut::<SimulationTime>().tick =
MINUTES_PER_PHASE * TICKS_PER_GAME_MINUTE;
world.resource_mut::<SimulationTime>().tick = MINUTES_PER_PHASE * TICKS_PER_GAME_MINUTE;
let mut schedule = bevy_ecs::schedule::Schedule::default();
schedule.add_systems(check_phase_transition);
+22 -6
View File
@@ -30,22 +30,38 @@ const ORIGIN_X: i32 = 0;
const ORIGIN_Y: i32 = 104;
/// Observer position for Sound Lab tests (absolute).
pub const OBSERVER_POS: TilePosition = TilePosition { x: 10, y: 114, z: 0 };
pub const OBSERVER_POS: TilePosition = TilePosition {
x: 10,
y: 114,
z: 0,
};
/// Close-range emitter position — 2 tiles east of observer (dist=2, Close ≤3).
pub const CLOSE_EMITTER_POS: TilePosition = TilePosition { x: 12, y: 114, z: 0 };
pub const CLOSE_EMITTER_POS: TilePosition = TilePosition {
x: 12,
y: 114,
z: 0,
};
/// Medium-range emitter position — 6 tiles east of observer (dist=6, Medium ≤8, outside Close).
pub const MEDIUM_EMITTER_POS: TilePosition = TilePosition { x: 16, y: 114, z: 0 };
pub const MEDIUM_EMITTER_POS: TilePosition = TilePosition {
x: 16,
y: 114,
z: 0,
};
/// Long-range emitter position — 12 tiles east of observer (dist=12, Long ≤20, outside Medium).
pub const LONG_EMITTER_POS: TilePosition = TilePosition { x: 22, y: 114, z: 0 };
pub const LONG_EMITTER_POS: TilePosition = TilePosition {
x: 22,
y: 114,
z: 0,
};
/// NPC definitions: (relative_x, relative_y, want_kind, intensity).
const NPCS: &[(i32, i32, WantKind, u8)] = &[
(12, 10, WantKind::Safety, 3), // npc_sound_close — StableId 66
(12, 10, WantKind::Safety, 3), // npc_sound_close — StableId 66
(16, 10, WantKind::Knowledge, 4), // npc_sound_medium — StableId 67
(22, 10, WantKind::Freedom, 5), // npc_sound_long — StableId 68
(22, 10, WantKind::Freedom, 5), // npc_sound_long — StableId 68
];
/// Spawn Sound Lab entities in canonical order (StableId 66-68).
+28 -6
View File
@@ -25,16 +25,32 @@ use crate::simulation::interaction::{DoorState, Interactable, ObjectType};
use crate::simulation::movement::TilePosition;
/// Observer start position — Terminal side of the zone boundary.
pub const OBSERVER_POS: TilePosition = TilePosition { x: 70, y: 112, z: 0 };
pub const OBSERVER_POS: TilePosition = TilePosition {
x: 70,
y: 112,
z: 0,
};
/// Door position — first tile of the Corridor zone (zone boundary).
pub const DOOR_POS: TilePosition = TilePosition { x: 72, y: 112, z: 0 };
pub const DOOR_POS: TilePosition = TilePosition {
x: 72,
y: 112,
z: 0,
};
/// Last walkable tile of the Terminal zone before the boundary.
pub const TERMINAL_SIDE_POS: TilePosition = TilePosition { x: 71, y: 112, z: 0 };
pub const TERMINAL_SIDE_POS: TilePosition = TilePosition {
x: 71,
y: 112,
z: 0,
};
/// First walkable tile of the Corridor zone after the boundary.
pub const CORRIDOR_SIDE_POS: TilePosition = TilePosition { x: 73, y: 112, z: 0 };
pub const CORRIDOR_SIDE_POS: TilePosition = TilePosition {
x: 73,
y: 112,
z: 0,
};
/// Spawn Zone Gate entities in canonical order (StableId 75).
pub fn spawn_entities(app: &mut App, registry: &mut EntityRegistry) {
@@ -149,7 +165,11 @@ mod tests {
ZONE_GATE_TERMINAL_ZONE_ID
);
assert_eq!(
zone_map.zone_at(TERMINAL_SIDE_POS.x, TERMINAL_SIDE_POS.y, TERMINAL_SIDE_POS.z),
zone_map.zone_at(
TERMINAL_SIDE_POS.x,
TERMINAL_SIDE_POS.y,
TERMINAL_SIDE_POS.z
),
Some(ZONE_GATE_TERMINAL_ZONE_ID),
"Tile (71,112) must be in Terminal zone"
);
@@ -267,7 +287,9 @@ mod tests {
world.resource_mut::<ZoneCrossEventQueue>().drain();
// Move within Terminal zone (same zone, different tile).
world.entity_mut(player).insert(TilePosition::new(68, 112, 0));
world
.entity_mut(player)
.insert(TilePosition::new(68, 112, 0));
sched.run(&mut world);
let events = world.resource_mut::<ZoneCrossEventQueue>().drain();