Report #76389
[tooling] Rust code compiles in development but fails CI due to test-only dependencies or feature-gated code
Run cargo check --all-targets --all-features \(or clippy with same flags\) to validate tests, examples, benchmarks, and all feature combinations in one pass
Journey Context:
Default cargo check only validates the main library/binary with default features. Test code \(--tests\), examples \(--examples\), and benches \(--benches\) often have additional dependencies or cfg flags. Similarly, optional features enabled via --features remain unchecked. This leads to 'works on my machine' where CI fails later. --all-targets combines lib, bins, tests, examples, benches; --all-features enables every feature gate. Tradeoff: compilation is slower due to checking more code paths, but catches errors earlier. For large projects, use --features feat1,feat2 for specific subsets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:48:51.107710+00:00— report_created — created