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
+13 -4
View File
@@ -66,14 +66,20 @@ fn player_moves_north_through_full_pipeline() {
rmp_serde::from_slice(&response).expect("deserialize snapshot");
// Snapshot captures state at end of tick 0 (before advance_tick increments to 1)
assert_eq!(snapshot.version, 6);
assert_eq!(snapshot.version, PROTOCOL_VERSION);
assert_eq!(snapshot.tick, 0);
assert_eq!(snapshot.entities.len(), 1);
// v2 fields populated
assert_eq!(snapshot.game_time.day, 0);
assert_eq!(snapshot.game_time.day_phase, settled_reach_server::simulation::time::DayPhase::Morning);
assert_eq!(snapshot.game_time.tick_rate, settled_reach_server::simulation::time::TickRate::Full);
assert_eq!(
snapshot.game_time.day_phase,
settled_reach_server::simulation::time::DayPhase::Morning
);
assert_eq!(
snapshot.game_time.tick_rate,
settled_reach_server::simulation::time::TickRate::Full
);
let player_entity = &snapshot.entities[0];
// Player started at (16, 16, 0), moved north (y-1) to (16, 15, 0)
@@ -82,7 +88,10 @@ fn player_moves_north_through_full_pipeline() {
assert_eq!(player_entity.y, 15.5);
assert_eq!(player_entity.z, 0);
assert!(matches!(player_entity.kind, EntityKind::Player));
assert!(matches!(player_entity.visibility, VisibilitySector::Forward));
assert!(matches!(
player_entity.visibility,
VisibilitySector::Forward
));
// Clean up
drop(reader);
+6 -4
View File
@@ -4,9 +4,9 @@
//! Run with: cargo test --test shadowcast_bench -- --ignored --nocapture
use rand::Rng;
use rand_chacha::ChaCha8Rng;
use rand::SeedableRng;
use settled_reach_server::perception::shadowcast::{symmetric_shadowcast, recursive_shadowcast};
use rand_chacha::ChaCha8Rng;
use settled_reach_server::perception::shadowcast::{recursive_shadowcast, symmetric_shadowcast};
use std::collections::HashSet;
use std::time::Instant;
@@ -173,12 +173,14 @@ fn benchmark_symmetric_vs_recursive() {
let results = bench_config(&config);
println!(" Symmetric: {:.2}ms total, {:.2}µs/call, {:.1} tiles avg",
println!(
" Symmetric: {:.2}ms total, {:.2}µs/call, {:.1} tiles avg",
results.symmetric_ms,
results.symmetric_ms * 1000.0 / config.iterations as f64,
results.symmetric_avg_tiles
);
println!(" Recursive: {:.2}ms total, {:.2}µs/call, {:.1} tiles avg",
println!(
" Recursive: {:.2}ms total, {:.2}µs/call, {:.1} tiles avg",
results.recursive_ms,
results.recursive_ms * 1000.0 / config.iterations as f64,
results.recursive_avg_tiles