Skip to content

chore: clear remaining clippy lints and stop compiling tests in non-test builds - #651

Merged
davincios merged 1 commit into
mainfrom
fix/clippy-cleanup
May 6, 2026
Merged

chore: clear remaining clippy lints and stop compiling tests in non-test builds#651
davincios merged 1 commit into
mainfrom
fix/clippy-cleanup

Conversation

@davincios

Copy link
Copy Markdown
Collaborator

Follow-up to #650.

main is now clean on cargo clippy -- -D warnings (CI's command), but clippy with --all-targets was still emitting 7 warnings in test code that's pre-existing. CI's check hides them because it doesn't lint test targets — anyone running clippy locally with --all-targets (or running cargo test-time clippy) hits them.

This PR clears them all and fixes one related correctness issue.

Changes

  • clippy::assertions_on_constants (6x) — replace placeholder assert!(true) bodies in cli/handlers/update/{tests,updater}.rs:
    • Three mock-shaped tests (test_update_impl_error_handling, test_update_impl_success_path, test_sentry_error_reporting) had nothing to assert; the comments explicitly described them as "placeholders for the testing structure". Now empty bodies marked #[ignore = "placeholder: ..."] so they show up under cargo test -- --ignored without polluting the default run.
    • Trivial "did construction succeed" tests drop the redundant assert!(true) since reaching the line already proves the test passed.
    • test_update_impl_structure becomes test_update_impl_signature_is_stable and asserts the function signature compiles to fn() -> Result<()>, which is what the original comment said the test was meant to do.
  • clippy::module_inceptioncloud_providers/aws/pricing/tests.rs previously wrapped its contents in an inner mod tests { ... }, producing the path pricing::tests::tests. Removed the wrapper; the file is itself the tests module.
  • Correctness: cloud_providers/aws/pricing/mod.rs declared the tests submodule with pub mod tests;, which compiled the test code in non-test builds and re-exported it publicly. Switched to #[cfg(test)] mod tests; so test code is test-only and private. This is a small but real bug — the test module's mock_metadata, setup_client, etc. were being included in release binaries.

Verification

  • cargo clippy --all-targets -- -D warnings → clean (was 7 warnings → 7 errors with -D)
  • cargo clippy -- -D warnings (CI's exact command) → clean
  • cargo fmt --all -- --check → clean
  • cargo test --features test-bins → all suites pass; 106 lib tests pass, 5 ignored (3 newly-marked placeholders + 2 pre-existing #[ignore]d pricing tests)
  • cargo audit → 0 vulnerabilities

Test plan

Made with Cursor

…est builds

`cargo clippy --all-targets -- -D warnings` was failing on `main` due to a
handful of pre-existing lints in test code. CI's `cargo clippy -- -D warnings`
hid these because it does not lint test targets, but anyone running clippy
locally with `--all-targets` (or doing a `cargo test`-time clippy) hit them.

Changes:

- `clippy::assertions_on_constants` (6 occurrences) — replace placeholder
  `assert!(true)` bodies in `cli/handlers/update/{tests,updater}.rs`. Three
  mock-shaped tests that genuinely had nothing to assert are now empty bodies
  marked `#[ignore = "placeholder: ..."]` so they show up under
  `cargo test -- --ignored` but no longer pollute the default run. Trivial
  "did construction succeed" tests drop the redundant `assert!(true)` since
  reaching the line already proves the test passed.
- `clippy::module_inception` —
  `cloud_providers/aws/pricing/tests.rs` previously wrapped its contents in an
  inner `mod tests { ... }`, producing the path
  `pricing::tests::tests`. Removed the wrapper; the file is itself the
  `tests` module.
- `cloud_providers/aws/pricing/mod.rs` declared the `tests` submodule with
  `pub mod tests;`, which compiled the test code in non-test builds and
  re-exported it. Switched to `#[cfg(test)] mod tests;` so test code is
  test-only and private.

Verification (post-PR #650 main):

- `cargo clippy --all-targets -- -D warnings` -> clean (was 6 warnings → -D
  warnings made them errors).
- `cargo clippy -- -D warnings` (CI's exact command) -> clean.
- `cargo fmt --all -- --check` -> clean.
- `cargo test --features test-bins` -> all suites pass; 106 lib tests pass
  with 5 ignored (3 newly-marked placeholders + 2 pre-existing).
- `cargo audit` -> 0 vulnerabilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying tracer-client with  Cloudflare Pages  Cloudflare Pages

Latest commit: 49a344a
Status: ✅  Deploy successful!
Preview URL: https://a5e7244d.tracer-client.pages.dev
Branch Preview URL: https://fix-clippy-cleanup.tracer-client.pages.dev

View logs

@davincios
davincios merged commit 98350db into main May 6, 2026
14 checks passed
@davincios
davincios deleted the fix/clippy-cleanup branch May 6, 2026 22:16
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