From 88712ba54f9cf6604e512048cb59e0797678a7d3 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 23 May 2026 10:37:43 +0200 Subject: [PATCH] style: clippy-1.93 machine-applicable auto-fixes (#967) cargo clippy --fix on files the new clippy (1.93) flags: unused imports (name_index, storyteller), manual_range_contains (block_irregularity), length-comparison/is_empty (layer3, serialization). All behavior-preserving. Surfaced because a warm target/ makes the pre-push hook actually run clippy (it skips on cold worktrees). Remaining non-auto-fixable test-code lints tracked in #967. Co-Authored-By: Claude Opus 4.7 (1M context) --- server/src/atlas/block_irregularity.rs | 2 +- server/src/simulation/name_index.rs | 2 +- server/src/storyteller/mod.rs | 2 +- server/tests/layer3.rs | 2 +- server/tests/serialization.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/atlas/block_irregularity.rs b/server/src/atlas/block_irregularity.rs index f7efdfc09..cac168af6 100644 --- a/server/src/atlas/block_irregularity.rs +++ b/server/src/atlas/block_irregularity.rs @@ -110,7 +110,7 @@ mod tests { for a in &archetypes { let v = block_irregularity(300, a); assert!( - v >= 0.05 && v <= 1.0, + (0.05..=1.0).contains(&v), "archetype {:?} gave {v} out of [0.05, 1.0]", a ); diff --git a/server/src/simulation/name_index.rs b/server/src/simulation/name_index.rs index 3d877091d..15eb07b78 100644 --- a/server/src/simulation/name_index.rs +++ b/server/src/simulation/name_index.rs @@ -184,7 +184,7 @@ fn collect_names(conn: &Connection) -> rusqlite::Result> { #[cfg(test)] mod tests { use super::*; - use aho_corasick::{AhoCorasick, AhoCorasickBuilder, MatchKind}; + use aho_corasick::{AhoCorasickBuilder, MatchKind}; /// Build a minimal index directly (no DB) for unit testing. fn make_index(pairs: &[(&str, &str)]) -> SystemNameIndex { diff --git a/server/src/storyteller/mod.rs b/server/src/storyteller/mod.rs index bcab0ce07..96b6d0891 100644 --- a/server/src/storyteller/mod.rs +++ b/server/src/storyteller/mod.rs @@ -1172,7 +1172,7 @@ mod tests { #[test] fn escalate_inserts_routine_deviation_on_triangle_npcs() { use crate::knowledge::registry::EntityRegistry; - use crate::knowledge::types::StableId; + use crate::npc::{Npc, RoutineDeviation}; let mut world = World::new(); diff --git a/server/tests/layer3.rs b/server/tests/layer3.rs index c528752fa..5fd5d6ca7 100644 --- a/server/tests/layer3.rs +++ b/server/tests/layer3.rs @@ -102,7 +102,7 @@ fn server_subprocess_sends_snapshot_on_connect() { // 8. Assert protocol correctness (D-020) assert!( - snapshot.entities.len() > 0, + !snapshot.entities.is_empty(), "snapshot should contain at least one entity (the player), got 0" ); diff --git a/server/tests/serialization.rs b/server/tests/serialization.rs index 4bf12ac2e..62b9002b1 100644 --- a/server/tests/serialization.rs +++ b/server/tests/serialization.rs @@ -1065,7 +1065,7 @@ fn gdscript_generated_fixtures_deserialize() { ); let mut count = 0; - for entry in fs::read_dir(&fixture_dir).expect("read gdscript fixture dir") { + for entry in fs::read_dir(fixture_dir).expect("read gdscript fixture dir") { let entry = entry.expect("read dir entry"); let path = entry.path(); if path.extension().and_then(|e| e.to_str()) != Some("msgpack") {