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:
@@ -110,10 +110,8 @@ impl Stage1Filter {
|
||||
}
|
||||
|
||||
// Exclude ToldBy-source facts (Cautious behavior)
|
||||
if self.exclude_told_by {
|
||||
if matches!(fact.source, KnowledgeSource::ToldBy { .. }) {
|
||||
return false;
|
||||
}
|
||||
if self.exclude_told_by && matches!(fact.source, KnowledgeSource::ToldBy { .. }) {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
@@ -192,9 +190,11 @@ impl TraitModifierConfig {
|
||||
/// Delegates to `KnowledgeConfidence::try_from` (which accepts both
|
||||
/// camelCase and underscore forms) rather than duplicating the match.
|
||||
fn parse_confidence(s: &str) -> Option<KnowledgeConfidence> {
|
||||
KnowledgeConfidence::try_from(s).map_err(|e| {
|
||||
tracing::warn!("Unknown confidence level in trait config: {}", e);
|
||||
}).ok()
|
||||
KnowledgeConfidence::try_from(s)
|
||||
.map_err(|e| {
|
||||
tracing::warn!("Unknown confidence level in trait config: {}", e);
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
||||
/// Convert a `PersonalityTrait` to its lowercase YAML key.
|
||||
@@ -286,8 +286,14 @@ modifiers:
|
||||
KnowledgeSource::DirectObservation { tick: 50 },
|
||||
);
|
||||
|
||||
assert!(!cautious.allows_fact(&suspects_fact), "Cautious excludes Suspects");
|
||||
assert!(cautious.allows_fact(&details_fact), "Cautious allows KnowsDetails");
|
||||
assert!(
|
||||
!cautious.allows_fact(&suspects_fact),
|
||||
"Cautious excludes Suspects"
|
||||
);
|
||||
assert!(
|
||||
cautious.allows_fact(&details_fact),
|
||||
"Cautious allows KnowsDetails"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -302,7 +308,10 @@ modifiers:
|
||||
tick: 50,
|
||||
},
|
||||
);
|
||||
assert!(!cautious.allows_fact(&told_fact), "Cautious excludes ToldBy");
|
||||
assert!(
|
||||
!cautious.allows_fact(&told_fact),
|
||||
"Cautious excludes ToldBy"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -314,7 +323,10 @@ modifiers:
|
||||
KnowledgeConfidence::Suspects,
|
||||
KnowledgeSource::DirectObservation { tick: 50 },
|
||||
);
|
||||
assert!(gossipy.allows_fact(&suspects_fact), "Gossipy includes Suspects");
|
||||
assert!(
|
||||
gossipy.allows_fact(&suspects_fact),
|
||||
"Gossipy includes Suspects"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -417,10 +429,22 @@ modifiers:
|
||||
|
||||
#[test]
|
||||
fn parse_confidence_values() {
|
||||
assert_eq!(parse_confidence("suspects"), Some(KnowledgeConfidence::Suspects));
|
||||
assert_eq!(parse_confidence("knows_of"), Some(KnowledgeConfidence::KnowsOf));
|
||||
assert_eq!(parse_confidence("knows_details"), Some(KnowledgeConfidence::KnowsDetails));
|
||||
assert_eq!(parse_confidence("direct"), Some(KnowledgeConfidence::Direct));
|
||||
assert_eq!(
|
||||
parse_confidence("suspects"),
|
||||
Some(KnowledgeConfidence::Suspects)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_confidence("knows_of"),
|
||||
Some(KnowledgeConfidence::KnowsOf)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_confidence("knows_details"),
|
||||
Some(KnowledgeConfidence::KnowsDetails)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_confidence("direct"),
|
||||
Some(KnowledgeConfidence::Direct)
|
||||
);
|
||||
assert_eq!(parse_confidence("invalid"), None);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user