Keeping the codebase clean is as important as adding features. RustAPI accumulates "dead code" easily when features are iterated on rapidly.
We provide a unified script to handle linting, dead code detection, and testing.
.\scripts\check_quality.ps1The script runs cargo check with RUSTFLAGS="-W unused".
Action: Delete it. Don't comment it out. Git history remembers it if you need it back.
Action: Use #[allow(dead_code)].
Be explicit.
#[allow(dead_code)] // Planned for phase 2
fn future_helper() { ... }Struct fields that are only used in Debug impls or serialization might flag as unused.
Action: Check if you really need that field. If yes, ignore the warning or derive Allow.
We enforce cargo clippy -- -D warnings in CI.
- Complexity: If clippy says a function is too complex, refactor it.
- Optimization: If clippy suggests a faster iterator method, take it.