refactor(server): apply rustfmt and clippy suggestions

Formatting pass across simulation, perception, knowledge, NPC, and
test modules. Includes two clippy fixes in monologue.rs (.values()
instead of for (_, v) pattern).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 00:40:43 +01:00
co-authored by Claude Opus 4.6
parent 8ec875385a
commit d0663c4193
21 changed files with 600 additions and 274 deletions
+10 -13
View File
@@ -210,14 +210,12 @@ mod tests {
let mut schedule = bevy_ecs::schedule::Schedule::default();
schedule.add_systems((
compute_visibility_geometry,
compute_observer_snapshot
.after(compute_visibility_geometry),
compute_observer_snapshot.after(compute_visibility_geometry),
crate::perception::observation::emit_observation_events
.after(compute_observer_snapshot),
generate_observation_events
.after(crate::perception::observation::emit_observation_events),
crate::knowledge::events::process_knowledge_events
.after(generate_observation_events),
crate::knowledge::events::process_knowledge_events.after(generate_observation_events),
));
schedule.run(world);
}
@@ -228,8 +226,7 @@ mod tests {
let mut registry = EntityRegistry::new(0);
// Set time to 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 player = world
.spawn((
@@ -381,7 +378,11 @@ mod tests {
)
})
.collect();
assert_eq!(absences.len(), 1, "should detect absence at visible location");
assert_eq!(
absences.len(),
1,
"should detect absence at visible location"
);
}
#[test]
@@ -401,9 +402,7 @@ mod tests {
.id();
registry.register(player);
let npc = world
.spawn((Npc, TilePosition::new(16, 14, 0)))
.id();
let npc = world.spawn((Npc, TilePosition::new(16, 14, 0))).id();
let npc_sid = registry.register(npc);
world.insert_resource(registry);
@@ -428,9 +427,7 @@ mod tests {
let mut world = setup_world();
let mut registry = EntityRegistry::new(0);
let npc = world
.spawn((Npc, TilePosition::new(16, 14, 0)))
.id();
let npc = world.spawn((Npc, TilePosition::new(16, 14, 0))).id();
let npc_sid = registry.register(npc);
// Player already knows about the NPC
+1 -2
View File
@@ -62,8 +62,7 @@ impl PerceptionQuery for NaturalVision {
z,
);
let cone_tiles =
apply_vision_cone(&fov, observer_pos.x, observer_pos.y, facing, &config);
let cone_tiles = apply_vision_cone(&fov, observer_pos.x, observer_pos.y, facing, &config);
let visible_tiles = cone_tiles
.iter()
+6 -1
View File
@@ -101,7 +101,12 @@ pub fn symmetric_shadowcast(
visible.insert((origin_x, origin_y)); // Origin is always visible
// Process 4 cardinal quadrants
for &cardinal in &[Cardinal::North, Cardinal::East, Cardinal::South, Cardinal::West] {
for &cardinal in &[
Cardinal::North,
Cardinal::East,
Cardinal::South,
Cardinal::West,
] {
scan_quadrant(&mut visible, is_opaque, origin_x, origin_y, range, cardinal);
}
+1 -2
View File
@@ -138,8 +138,7 @@ pub fn apply_vision_cone(
) -> Vec<(i32, i32, VisibilitySector)> {
fov.visible_tiles()
.filter_map(|(x, y)| {
classify_tile(observer_x, observer_y, x, y, facing, config)
.map(|sector| (x, y, sector))
classify_tile(observer_x, observer_y, x, y, facing, config).map(|sector| (x, y, sector))
})
.collect()
}