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:
@@ -141,7 +141,11 @@ mod tests {
|
||||
graph.set_relationship(a, StableId(20), make_edge(RelationshipKind::Colleague, 2));
|
||||
graph.set_relationship(a, StableId(30), make_edge(RelationshipKind::Rival, -3));
|
||||
// Different subject — should not appear
|
||||
graph.set_relationship(StableId(2), StableId(10), make_edge(RelationshipKind::Family, 8));
|
||||
graph.set_relationship(
|
||||
StableId(2),
|
||||
StableId(10),
|
||||
make_edge(RelationshipKind::Family, 8),
|
||||
);
|
||||
|
||||
let rels = graph.relationships_of(&a);
|
||||
assert_eq!(rels.len(), 3);
|
||||
@@ -158,9 +162,17 @@ mod tests {
|
||||
|
||||
graph.set_relationship(StableId(1), target, make_edge(RelationshipKind::Friend, 5));
|
||||
graph.set_relationship(StableId(2), target, make_edge(RelationshipKind::Rival, -2));
|
||||
graph.set_relationship(StableId(3), target, make_edge(RelationshipKind::Colleague, 0));
|
||||
graph.set_relationship(
|
||||
StableId(3),
|
||||
target,
|
||||
make_edge(RelationshipKind::Colleague, 0),
|
||||
);
|
||||
// Edge to different target — should not appear
|
||||
graph.set_relationship(StableId(1), StableId(99), make_edge(RelationshipKind::Family, 8));
|
||||
graph.set_relationship(
|
||||
StableId(1),
|
||||
StableId(99),
|
||||
make_edge(RelationshipKind::Family, 8),
|
||||
);
|
||||
|
||||
let knowers = graph.who_knows(&target);
|
||||
assert_eq!(knowers.len(), 3);
|
||||
@@ -199,9 +211,21 @@ mod tests {
|
||||
fn deterministic_iteration() {
|
||||
let mut graph = RelationshipGraph::new();
|
||||
// Insert in arbitrary order
|
||||
graph.set_relationship(StableId(3), StableId(1), make_edge(RelationshipKind::Rival, -1));
|
||||
graph.set_relationship(StableId(1), StableId(2), make_edge(RelationshipKind::Friend, 5));
|
||||
graph.set_relationship(StableId(2), StableId(3), make_edge(RelationshipKind::Colleague, 0));
|
||||
graph.set_relationship(
|
||||
StableId(3),
|
||||
StableId(1),
|
||||
make_edge(RelationshipKind::Rival, -1),
|
||||
);
|
||||
graph.set_relationship(
|
||||
StableId(1),
|
||||
StableId(2),
|
||||
make_edge(RelationshipKind::Friend, 5),
|
||||
);
|
||||
graph.set_relationship(
|
||||
StableId(2),
|
||||
StableId(3),
|
||||
make_edge(RelationshipKind::Colleague, 0),
|
||||
);
|
||||
|
||||
// Iteration order should be deterministic (sorted by (subject, target))
|
||||
let keys: Vec<_> = graph.edges.keys().collect();
|
||||
|
||||
Reference in New Issue
Block a user