refactor(server): fix clippy warnings from Rust 1.93

- Use #[derive(Default)] + #[default] instead of manual Default impls
  for FacingDirection, KnowledgeState, RelationshipState, EntityVisibility
- Replace manual modulo check with .is_multiple_of()
- Collapse nested if in shadowcast symmetry check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 18:18:04 +01:00
co-authored by Claude Opus 4.6
parent 2fd16f08b0
commit ad653cffc3
4 changed files with 12 additions and 34 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ pub fn decay_knowledge(
mut knowledge_query: Query<&mut KnowledgeGraph>,
) {
// Decay runs every 10 ticks (1 game-minute per D-031)
if time.tick % 10 != 0 {
if !time.tick.is_multiple_of(10) {
return;
}
for mut kg in knowledge_query.iter_mut() {
+6 -21
View File
@@ -70,9 +70,10 @@ impl KnowledgeConfidence {
/// Temporal/logical state of a knowledge entry.
/// Orthogonal to confidence: a KnowsDetails entry can be Active or Contradicted.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum KnowledgeState {
/// Currently believed true. Default state.
#[default]
Active,
/// Conflicting information exists. Both conflicting entries receive this state.
/// Triggers monologue event when set. THE FRIEND arc detector.
@@ -82,12 +83,6 @@ pub enum KnowledgeState {
Stale,
}
impl Default for KnowledgeState {
fn default() -> Self {
Self::Active
}
}
// --- Knowledge Source ---
/// How knowledge was acquired. Tracked per-entry for provenance.
@@ -119,9 +114,10 @@ pub enum SoundRange {
/// Relationship state drives D-033 entity color rendering.
/// Derived from knowledge + NPC relationship axes (D-024).
/// Client maps this to color palette defined in D-033.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize)]
pub enum RelationshipState {
/// No prior knowledge. Teal #4a9ebb.
#[default]
Unknown,
/// Recognized, neutral-to-positive. Soft green #6bc9a6.
Known,
@@ -133,12 +129,6 @@ pub enum RelationshipState {
Hostile,
}
impl Default for RelationshipState {
fn default() -> Self {
Self::Unknown
}
}
// --- Entity Knowledge ---
/// What entity A knows about entity B.
@@ -205,9 +195,10 @@ impl Default for DecayThresholds {
/// How an entity appears in the observer snapshot.
/// Extends VisibleEntity for knowledge-based rendering.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub enum EntityVisibility {
/// Currently in line of sight.
#[default]
Visible,
/// Not in LOS but remembered from knowledge graph.
Remembered {
@@ -215,9 +206,3 @@ pub enum EntityVisibility {
age_ticks: u64,
},
}
impl Default for EntityVisibility {
fn default() -> Self {
Self::Visible
}
}