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();
|
||||
|
||||
@@ -55,11 +55,9 @@ pub fn check_phase_transition(
|
||||
for (entity, current_pos, routine) in npcs.iter() {
|
||||
if let Some(expected_location) = routine.expected_location(current_phase) {
|
||||
if *current_pos != expected_location {
|
||||
commands
|
||||
.entity(entity)
|
||||
.insert(PathRequest {
|
||||
goal: expected_location,
|
||||
});
|
||||
commands.entity(entity).insert(PathRequest {
|
||||
goal: expected_location,
|
||||
});
|
||||
tracing::trace!(
|
||||
"Entity {:?}: routine path request to {:?} for {:?}",
|
||||
entity,
|
||||
@@ -105,8 +103,7 @@ mod tests {
|
||||
.id();
|
||||
|
||||
// Advance time to Afternoon boundary
|
||||
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 mut schedule = bevy_ecs::schedule::Schedule::default();
|
||||
schedule.add_systems(check_phase_transition);
|
||||
@@ -163,8 +160,7 @@ mod tests {
|
||||
))
|
||||
.id();
|
||||
|
||||
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 mut schedule = bevy_ecs::schedule::Schedule::default();
|
||||
schedule.add_systems(check_phase_transition);
|
||||
@@ -193,8 +189,7 @@ mod tests {
|
||||
.id();
|
||||
|
||||
// Transition to Afternoon, but NPC only has Morning entry
|
||||
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 mut schedule = bevy_ecs::schedule::Schedule::default();
|
||||
schedule.add_systems(check_phase_transition);
|
||||
|
||||
Reference in New Issue
Block a user