feat(simulation): ban HashMap via clippy disallowed_types, fix violations (#343)
Adds server/.clippy.toml with disallowed-types for std::collections::HashMap and std::collections::HashSet. HashMap iteration order is non-deterministic and breaks deterministic simulation replay (D-030). Changes: - server/.clippy.toml: disallow HashMap and HashSet crate-wide - simulation/movement.rs: WalkabilityMap.chunks and occupied map → BTreeMap; add PartialOrd+Ord to ChunkCoord, TilePosition, TilePresence - simulation/monologue.rs: MonologueState.shown_ids → BTreeSet (simulation state) - perception/shadowcast.rs: #![allow] — per-frame FOV scratch, iteration irrelevant - perception/interpretation.rs: #![allow] — per-frame lookup table, key-only access - perception/query.rs: #![allow] — sector_lookup is a per-frame read-only cache Also applies cargo fmt to pre-existing format drift in contraband.rs, dialogue.rs, test_world/mod.rs, and several integration tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
//! Interprets what the observer sees (and doesn't see) against known NPC
|
||||
//! routines and knowledge graph state. Produces high-level observation events
|
||||
//! that drive monologue and investigation triggers.
|
||||
//!
|
||||
//! Note: HashSet is used as a per-frame lookup table (visible tiles/NPCs).
|
||||
//! Only membership checks — iteration order is irrelevant. Not simulation state.
|
||||
#![allow(clippy::disallowed_types)]
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
//! References:
|
||||
//! - Symmetric: https://www.albertford.com/shadowcasting/
|
||||
//! - Traditional: RogueBasin recursive shadowcasting
|
||||
//!
|
||||
//! Note: HashSet is used here as a per-frame scratch accumulator for visible
|
||||
//! tile positions during the FOV sweep. Only `insert` and `contains` are used;
|
||||
//! iteration order never affects the output (results are handed to BTreeSet in
|
||||
//! query.rs). Not simulation state — exempt from the determinism constraint.
|
||||
#![allow(clippy::disallowed_types)]
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user