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:
@@ -16,7 +16,9 @@ use crate::bridge::types::MonologueEvent;
|
||||
use crate::knowledge::events::{
|
||||
KnowledgeEvent, KnowledgeEventType, ProcessedFactGrant, ProcessedKnowledgeGrant,
|
||||
};
|
||||
use crate::knowledge::types::{FactId, KnowledgeConfidence, KnowledgeSource, KnowledgeState, RelationshipState, StableId};
|
||||
use crate::knowledge::types::{
|
||||
FactId, KnowledgeConfidence, KnowledgeSource, KnowledgeState, RelationshipState, StableId,
|
||||
};
|
||||
use crate::knowledge::{KnowledgeEventQueue, KnowledgeGraph, StableEntityId};
|
||||
use crate::npc::mood::{MoodState, NpcMood};
|
||||
use crate::npc::relationships::RelationshipGraph;
|
||||
@@ -513,12 +515,23 @@ mod tests {
|
||||
let fact_id = FactId("investigation.clue".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::KnowsOf, KnowledgeState::Active, 5, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsOf,
|
||||
KnowledgeState::Active,
|
||||
5,
|
||||
false,
|
||||
),
|
||||
)]);
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
@@ -537,12 +550,23 @@ mod tests {
|
||||
let fact_id = FactId("secret.dangerous".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::KnowsDetails, KnowledgeState::Active, 5, true),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsDetails,
|
||||
KnowledgeState::Active,
|
||||
5,
|
||||
true,
|
||||
),
|
||||
)]);
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
@@ -561,12 +585,23 @@ mod tests {
|
||||
let fact_id = FactId("cargo.manifest".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::KnowsOf, KnowledgeState::Stale, 5, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsOf,
|
||||
KnowledgeState::Stale,
|
||||
5,
|
||||
false,
|
||||
),
|
||||
)]);
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
@@ -585,7 +620,12 @@ mod tests {
|
||||
let fact_id = FactId("dock.schedule".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::KnowsOf, KnowledgeState::Active, 5, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsOf,
|
||||
KnowledgeState::Active,
|
||||
5,
|
||||
false,
|
||||
),
|
||||
)]);
|
||||
|
||||
let mut cooldown = DisclosureCooldown::default();
|
||||
@@ -593,7 +633,13 @@ mod tests {
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, cooldown, DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
cooldown,
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
@@ -614,7 +660,12 @@ mod tests {
|
||||
.map(|i| {
|
||||
(
|
||||
FactId(format!("fact.{:02}", i)),
|
||||
make_fact(KnowledgeConfidence::KnowsOf, KnowledgeState::Active, i as u64, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsOf,
|
||||
KnowledgeState::Active,
|
||||
i as u64,
|
||||
false,
|
||||
),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
@@ -622,7 +673,13 @@ mod tests {
|
||||
let kg = make_kg(facts);
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
@@ -642,7 +699,12 @@ mod tests {
|
||||
let fact_id = FactId("investigation.clue".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::KnowsOf, KnowledgeState::Active, 5, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::KnowsOf,
|
||||
KnowledgeState::Active,
|
||||
5,
|
||||
false,
|
||||
),
|
||||
)]);
|
||||
|
||||
// Set computed_tick = 1 (non-zero). Tick 5 is within the 30-tick refresh window.
|
||||
@@ -651,7 +713,13 @@ mod tests {
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), candidates))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
candidates,
|
||||
))
|
||||
.id();
|
||||
|
||||
// Advance tick to 5 (within CANDIDATE_REFRESH_TICKS = 30).
|
||||
@@ -677,12 +745,23 @@ mod tests {
|
||||
let fact_id = FactId("rumour.vague".to_string());
|
||||
let kg = make_kg(vec![(
|
||||
fact_id.clone(),
|
||||
make_fact(KnowledgeConfidence::Suspects, KnowledgeState::Active, 5, false),
|
||||
make_fact(
|
||||
KnowledgeConfidence::Suspects,
|
||||
KnowledgeState::Active,
|
||||
5,
|
||||
false,
|
||||
),
|
||||
)]);
|
||||
|
||||
let npc = app
|
||||
.world_mut()
|
||||
.spawn((Npc, ActiveSim, kg, DisclosureCooldown::default(), DisclosureCandidates::default()))
|
||||
.spawn((
|
||||
Npc,
|
||||
ActiveSim,
|
||||
kg,
|
||||
DisclosureCooldown::default(),
|
||||
DisclosureCandidates::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
|
||||
Reference in New Issue
Block a user