fix(simulation): Clippy cleanup and CI enforcement (#635)
Fix all Clippy warnings across the server codebase (2411 insertions, 1341 deletions). Raise type-complexity-threshold to 750 and too-many-arguments to 12 in .clippy.toml for idiomatic Bevy ECS system signatures. The server now passes `cargo clippy -- --deny warnings` cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
use bevy_ecs::prelude::*;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
|
||||
use crate::bridge::types::*;
|
||||
use crate::knowledge::graph::filter_by_access;
|
||||
use crate::knowledge::types::{AccessRule, KnowledgeState};
|
||||
@@ -28,11 +27,11 @@ use crate::simulation::monologue::{MonologueBuffer, SprintAnomalyQueue};
|
||||
use crate::simulation::movement::{PlayerCharacter, TilePosition, WalkabilityMap};
|
||||
use crate::simulation::poi::PointOfInterest;
|
||||
use crate::simulation::rng::SimRng;
|
||||
use crate::simulation::triangle::TriangleCrisisEventQueue;
|
||||
use crate::simulation::sound::SoundEventQueue;
|
||||
use crate::simulation::stance::Stance;
|
||||
use crate::simulation::ticker::{TickerPool, LAST_SHIFT_ZONE_ID};
|
||||
use crate::simulation::time::SimulationTime;
|
||||
use crate::simulation::triangle::TriangleCrisisEventQueue;
|
||||
use crate::simulation::zone::ZoneMap;
|
||||
|
||||
/// Compute visibility geometry using the active perception mode.
|
||||
@@ -154,12 +153,15 @@ pub fn compute_observer_snapshot(
|
||||
.unwrap_or_default();
|
||||
|
||||
// Resolve observer's StableId for component-level access control (#139, D-010)
|
||||
let observer_stable_id = registry
|
||||
.to_stable(observer_entity)
|
||||
.unwrap_or(StableId(0));
|
||||
let observer_stable_id = registry.to_stable(observer_entity).unwrap_or(StableId(0));
|
||||
|
||||
let (mut entities, visible_ids, blocked_entities) =
|
||||
filter_visible_entities(&geometry, ®istry, observer_kg, observer_stable_id, &all_entities);
|
||||
let (mut entities, visible_ids, blocked_entities) = filter_visible_entities(
|
||||
&geometry,
|
||||
®istry,
|
||||
observer_kg,
|
||||
observer_stable_id,
|
||||
&all_entities,
|
||||
);
|
||||
|
||||
collect_remembered_entities(
|
||||
observer_kg,
|
||||
@@ -210,13 +212,14 @@ pub fn compute_observer_snapshot(
|
||||
|
||||
let current_monologue = monologue_buffer.take();
|
||||
let dialogue_response = dialogue_response_opt.as_mut().and_then(|buf| buf.take());
|
||||
let examine_result = examine_result_buffer_opt.as_mut().and_then(|buf| buf.take()).map(
|
||||
|evt| crate::bridge::types::ExamineResultWire {
|
||||
let examine_result = examine_result_buffer_opt
|
||||
.as_mut()
|
||||
.and_then(|buf| buf.take())
|
||||
.map(|evt| crate::bridge::types::ExamineResultWire {
|
||||
entity_id: evt.target_entity_id,
|
||||
text: evt.text,
|
||||
confidence: crate::knowledge::types::KnowledgeConfidence::KnowsDetails,
|
||||
},
|
||||
);
|
||||
});
|
||||
let scan_events = scan_event_buffer_opt
|
||||
.as_mut()
|
||||
.map(|buf| buf.take())
|
||||
@@ -438,9 +441,7 @@ pub fn compute_observer_snapshot(
|
||||
};
|
||||
|
||||
// Drain sim errors collected this tick (#85)
|
||||
let sim_errors = error_buffer
|
||||
.map(|mut buf| buf.drain())
|
||||
.unwrap_or_default();
|
||||
let sim_errors = error_buffer.map(|mut buf| buf.drain()).unwrap_or_default();
|
||||
|
||||
// News ticker (#591): populate when player is in The Last Shift zone.
|
||||
let player_zone = zone_map
|
||||
@@ -472,9 +473,10 @@ pub fn compute_observer_snapshot(
|
||||
conversation_events,
|
||||
conversation_ended,
|
||||
follow_state,
|
||||
character_pressure: pressure_query.iter().next().map(|p| {
|
||||
crate::simulation::pressure::CharacterPressureWire::from(p)
|
||||
}),
|
||||
character_pressure: pressure_query
|
||||
.iter()
|
||||
.next()
|
||||
.map(crate::simulation::pressure::CharacterPressureWire::from),
|
||||
sound_events,
|
||||
rng_seed: sim_rng.as_deref().map(|r| r.seed()),
|
||||
poi_list,
|
||||
|
||||
@@ -2258,7 +2258,9 @@ fn access_rule_knowledge_gated_passes_with_matching_fact() {
|
||||
.spawn((
|
||||
crate::npc::Npc,
|
||||
TilePosition::new(16, 14, 0),
|
||||
AccessRule(ObserverAccess::KnowledgeGated("contraband.ring_exists".into())),
|
||||
AccessRule(ObserverAccess::KnowledgeGated(
|
||||
"contraband.ring_exists".into(),
|
||||
)),
|
||||
))
|
||||
.id();
|
||||
let npc_sid = registry.register(npc);
|
||||
@@ -2323,7 +2325,9 @@ fn access_rule_knowledge_gated_redacts_without_fact() {
|
||||
.spawn((
|
||||
crate::npc::Npc,
|
||||
TilePosition::new(16, 14, 0),
|
||||
AccessRule(ObserverAccess::KnowledgeGated("conspiracy.mastermind".into())),
|
||||
AccessRule(ObserverAccess::KnowledgeGated(
|
||||
"conspiracy.mastermind".into(),
|
||||
)),
|
||||
))
|
||||
.id();
|
||||
let npc_sid = registry.register(npc);
|
||||
@@ -2636,9 +2640,15 @@ fn tell_state_nervous_appears_in_snapshot_for_major_secret_high_stress() {
|
||||
severity: SecretSeverity::Major,
|
||||
known_by: vec![],
|
||||
},
|
||||
ToleranceThreshold { current_stress: 60, threshold: 100 },
|
||||
ToleranceThreshold {
|
||||
current_stress: 60,
|
||||
threshold: 100,
|
||||
},
|
||||
Contentment { level: 0 },
|
||||
MoodState { mood: NpcMood::Neutral, changed_tick: 0 },
|
||||
MoodState {
|
||||
mood: NpcMood::Neutral,
|
||||
changed_tick: 0,
|
||||
},
|
||||
DerivedTellState::default(),
|
||||
));
|
||||
|
||||
@@ -2690,9 +2700,15 @@ fn tell_state_none_for_neutral_npc_in_snapshot() {
|
||||
severity: SecretSeverity::Minor,
|
||||
known_by: vec![],
|
||||
},
|
||||
ToleranceThreshold { current_stress: 10, threshold: 100 },
|
||||
ToleranceThreshold {
|
||||
current_stress: 10,
|
||||
threshold: 100,
|
||||
},
|
||||
Contentment { level: 0 },
|
||||
MoodState { mood: NpcMood::Neutral, changed_tick: 0 },
|
||||
MoodState {
|
||||
mood: NpcMood::Neutral,
|
||||
changed_tick: 0,
|
||||
},
|
||||
DerivedTellState::default(),
|
||||
));
|
||||
|
||||
@@ -2708,8 +2724,7 @@ fn tell_state_none_for_neutral_npc_in_snapshot() {
|
||||
.expect("NPC should be visible in snapshot");
|
||||
|
||||
assert_eq!(
|
||||
npc.tell_state,
|
||||
None,
|
||||
npc.tell_state, None,
|
||||
"neutral NPC should have no tell state in snapshot"
|
||||
);
|
||||
}
|
||||
@@ -2745,8 +2760,7 @@ fn tell_state_none_when_npc_has_no_derived_tell_component() {
|
||||
.expect("NPC should be visible in snapshot");
|
||||
|
||||
assert_eq!(
|
||||
npc.tell_state,
|
||||
None,
|
||||
npc.tell_state, None,
|
||||
"NPC without DerivedTellState component should have tell_state = None"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user