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
+15 -7
View File
@@ -30,8 +30,8 @@ use crate::perception::shadowcast::compute_fov;
use crate::perception::vision_cone::{apply_vision_cone, Facing, VisionConeConfig};
use crate::simulation::movement::{PlayerCharacter, TilePosition, WalkabilityMap};
use crate::simulation::spatial::{NaiveSpatialIndex, SpatialIndex};
use crate::simulation::time::{SimulationTime, TICKS_PER_GAME_MINUTE};
use crate::simulation::tier::ActiveSim;
use crate::simulation::time::{SimulationTime, TICKS_PER_GAME_MINUTE};
/// NPC vision range in tiles (matches player forward range from VisionConeConfig).
pub const NPC_VISION_RANGE: i32 = 20;
@@ -128,8 +128,7 @@ pub fn compute_npc_vision(
// Collect visible tile positions — apply vision cone if NPC has facing
let visible_positions: BTreeSet<(i32, i32)> = if let Some(facing_comp) = facing {
let cone_tiles =
apply_vision_cone(&fov, npc_pos.x, npc_pos.y, facing_comp.0, &config);
let cone_tiles = apply_vision_cone(&fov, npc_pos.x, npc_pos.y, facing_comp.0, &config);
cone_tiles.into_iter().map(|(x, y, _)| (x, y)).collect()
} else {
// No facing → omnidirectional vision (full FOV)
@@ -261,7 +260,7 @@ pub fn degrade_npc_inferences(
time: Res<SimulationTime>,
mut npc_query: Query<&mut NpcMemory, (With<Npc>, With<ActiveSim>)>,
) {
if time.tick % TICKS_PER_GAME_MINUTE != 0 {
if !time.tick.is_multiple_of(TICKS_PER_GAME_MINUTE) {
return;
}
@@ -595,7 +594,10 @@ mod tests {
schedule.run(&mut world);
let queue = world.resource::<KnowledgeEventQueue>();
assert!(!queue.is_empty(), "should emit DirectObservation for player");
assert!(
!queue.is_empty(),
"should emit DirectObservation for player"
);
let event = &queue.events[0];
assert_eq!(event.observer, npc);
@@ -653,7 +655,10 @@ mod tests {
KnowledgeEventType::LeftLOS { target } if target == player
)
});
assert!(has_left_los, "should emit LeftLOS when player leaves NPC LOS");
assert!(
has_left_los,
"should emit LeftLOS when player leaves NPC LOS"
);
// Check zone inference was created
let npc_memory = world.get::<NpcMemory>(npc).unwrap();
@@ -705,7 +710,10 @@ mod tests {
let entry = memory.last_known.get(&player_sid).unwrap();
assert_eq!(entry.position, pos(10, 10));
assert_eq!(entry.observed_tick, 100);
assert!(entry.zone_inference.is_none(), "active observation = no inference");
assert!(
entry.zone_inference.is_none(),
"active observation = no inference"
);
}
// --- degrade_npc_inferences tests ---