From 1c0b5b75aadd840cc9729f6cee47e83dfa07944e Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:09:05 +0900 Subject: [PATCH 1/2] build(lint): deny tests outside test modules Enable clippy::tests_outside_test_module as a warning so CI (-D warnings) rejects #[test] functions outside a #[cfg(test)] module. Co-Authored-By: Claude Sonnet 5.5 --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 09c6923..45745e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ wildcard_enum_match_arm = "warn" iter_over_hash_type = "warn" cognitive_complexity = "warn" excessive_nesting = "warn" +tests_outside_test_module = "warn" dbg_macro = "deny" todo = "deny" unimplemented = "deny" From 4e314b51d36d41a969d66a3d81f4565bf0d5993c Mon Sep 17 00:00:00 2001 From: furedea <132188853+furedea@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:12:19 +0900 Subject: [PATCH 2/2] ci: run clippy on all targets so test lints fire #[test] functions are compiled out of non-test builds, so tests_outside_test_module never fired under plain `cargo clippy`. Pass --all-targets in CI and in the pre-commit hook. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 2 +- lefthook.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b343a9..2928d59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: uses: furedea/reusable-workflows/.github/actions/nix-setup@2ae953294b9a805d0705657adc1d9d4f1bc1f646 # v1.3.0 - name: Run clippy - run: cargo clippy -- -D warnings + run: cargo clippy --all-targets -- -D warnings format: runs-on: ubuntu-latest diff --git a/lefthook.yml b/lefthook.yml index d9f30a1..64cb10d 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -20,7 +20,7 @@ pre-commit: run: cargo fmt --check clippy: glob: "*.rs" - run: cargo clippy -- -D warnings + run: cargo clippy --all-targets -- -D warnings ls-lint: run: ls_lint file-length: