Skip to content

chore: make dead code a compile error + drop dead index_types module#277

Merged
tobyhede merged 1 commit into
eql_v3from
v3-deny-dead-code
Jun 14, 2026
Merged

chore: make dead code a compile error + drop dead index_types module#277
tobyhede merged 1 commit into
eql_v3from
v3-deny-dead-code

Conversation

@tobyhede

Copy link
Copy Markdown
Contributor

Summary

Makes dead code a hard compile error workspace-wide, and removes a long-dead module that prompted it.

  • [workspace.lints] denying dead_code + unused_imports, with each member crate opting in via [lints] workspace = true. Dead code now fails plain cargo build / cargo test — not only the clippy -D warnings CI job — so an unused fn/field/variant/import can't rot silently.
  • Removed tests/sqlx/src/index_types.rs (+ its lib.rs mod and IndexTypes re-export). It was a typo-prevention constants scaffold added with the SQLx test migration (2025-10-27, a252cff) but never adopted — all six constants (HMAC, BLAKE3, ORE64, ORE_CLLW_U64_8, ORE_CLLW_VAR_8, ORE_BLOCK_U64_8_256) had zero references since the commit that created them. The tests use the literal strings ("hm", "ob", …) inline instead.

Why remove it by hand instead of letting the lint catch it?

rustc's dead_code lint exempts unused pub items in a library crate — it assumes a sibling/downstream crate may consume them. eql_tests is a lib whose integration tests (tests/*.rs) are separate crates that link it, so its pub harness items are always "potentially used", and the unused pub module slipped through. Verified: building with -D dead_code did not flag it. The lint guards the private dead-code case going forward; the pub exception is handled by the corollary rule now documented in the workspace Cargo.toml: don't mark a test-support item pub unless an integration test actually consumes it.

Test Plan

  • cargo build --workspace clean under the new deny policy (no dead-code/unused violations).
  • Every integration test target compiles clean under the policy (cargo test --no-run) — removing index_types broke nothing; no latent dead code to fix.
  • eql-scalars / eql-codegen / eql-tests-macros test suites green.
  • No code referenced index_types / IndexTypes (0 references, confirmed across full git history).

Notes

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 837b2af6-3f0e-41a6-8393-be3118160cb5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v3-deny-dead-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

… index_types

Adds a [workspace.lints] table denying dead_code and unused_imports, with each
member crate opting in via [lints] workspace = true. Dead code is now a hard
`cargo build`/`cargo test` error, not just a clippy -D warnings CI warning, so
an unused fn/field/variant/import cannot rot silently.

Also removes tests/sqlx/src/index_types.rs (and its lib.rs mod + IndexTypes
re-export). The module was a typo-prevention constants scaffold added with the
SQLx test migration (2025-10-27, a252cff) but never adopted — all six constants
had zero references since creation. It is the kind of dead code the new lint is
meant to stop, but rustc's dead_code lint exempts unused *pub* items in a lib
crate (it assumes a sibling/downstream crate may use them), and eql_tests is a
lib consumed by its integration tests, so the pub module slipped through. Removed
by hand; the lint guards the private-dead-code case going forward.

Verified: full workspace + every integration test target compiles clean under
the new deny policy; eql-scalars/eql-codegen/eql-tests-macros test suites green.
@tobyhede tobyhede force-pushed the v3-deny-dead-code branch from cf2fd4c to 741bc98 Compare June 11, 2026 22:28
@tobyhede tobyhede marked this pull request as ready for review June 12, 2026 06:12
@tobyhede tobyhede merged commit ee975b2 into eql_v3 Jun 14, 2026
11 checks passed
@tobyhede tobyhede deleted the v3-deny-dead-code branch June 14, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant