From 34777dd59613a8b0726bec61d5e0c152c3fb12a7 Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Tue, 10 Nov 2026 00:33:43 +0900 Subject: [PATCH 1/3] build: deny unwrap, expect, and unsafe code in production Copy agent-harness's dbg_macro, todo, and unimplemented deny and unsafe_code = "forbid". Add unwrap_used and expect_used (deny) and let tests use them through clippy.toml. Production code has 0 violations. Refs furedea/agent-config#74 Co-Authored-By: Claude Sonnet 5.5 --- Cargo.toml | 8 ++++++++ clippy.toml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6004a36..1955ad8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,17 @@ license = "MIT" [dependencies] +[lints.rust] +unsafe_code = "forbid" + [lints.clippy] all = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } allow_attributes_without_reason = "warn" cognitive_complexity = "warn" excessive_nesting = "warn" +dbg_macro = "deny" +todo = "deny" +unimplemented = "deny" +unwrap_used = "deny" +expect_used = "deny" diff --git a/clippy.toml b/clippy.toml index a1a18f9..0f13cf9 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,3 +1,5 @@ too-many-arguments-threshold = 3 excessive-nesting-threshold = 2 cognitive-complexity-threshold = 15 +allow-unwrap-in-tests = true +allow-expect-in-tests = true From 4ba1ec6a168cfd35892f36054fe3b8227ed0499c Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:11:01 +0900 Subject: [PATCH 2/3] build: deny indexing_slicing in production Match agent-harness: deny clippy::indexing_slicing and allow it in tests through clippy.toml. Production code has 0 violations. Refs furedea/agent-config#74 Co-Authored-By: Claude Sonnet 5.5 --- Cargo.toml | 1 + clippy.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1955ad8..5cc9431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,5 @@ dbg_macro = "deny" todo = "deny" unimplemented = "deny" unwrap_used = "deny" +indexing_slicing = "deny" expect_used = "deny" diff --git a/clippy.toml b/clippy.toml index 0f13cf9..aef6df2 100644 --- a/clippy.toml +++ b/clippy.toml @@ -3,3 +3,4 @@ excessive-nesting-threshold = 2 cognitive-complexity-threshold = 15 allow-unwrap-in-tests = true allow-expect-in-tests = true +allow-indexing-slicing-in-tests = true From 62f5cd4e0c76a516dd680c493e84757d17923d26 Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:11:08 +0900 Subject: [PATCH 3/3] test: assert the greeting instead of a constant assert!(true) checks nothing and fails clippy --all-targets (assertions_on_constants). Move the greeting into a function and test its value. Refs furedea/agent-config#74 Co-Authored-By: Claude Sonnet 5.5 --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7546a57..a120fb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,17 @@ fn main() { - println!("Hello, world!"); + println!("{}", greeting()); +} + +fn greeting() -> &'static str { + "Hello, world!" } #[cfg(test)] mod tests { + use super::greeting; + #[test] - fn it_works() { - assert!(true); + fn greeting_is_hello_world() { + assert_eq!(greeting(), "Hello, world!"); } }