RU

Rustfmt & Clippy

Standard Rust formatting and linting tools

Details

Language / Topic
rustRust
Category
Linter / Formatter
Source
rust-lang

Rules

balanced
- Run `cargo fmt` before every commit. Configure in `rustfmt.toml` if needed.
- Run `cargo clippy` and fix all warnings — Clippy catches common mistakes and unidiomatic code.
- Run `cargo clippy -- -W clippy::all` for comprehensive linting and `cargo fmt` for formatting — add both to CI.
- Use `cargo clippy -- -D warnings` in CI to treat warnings as errors.
- Use `#[allow(clippy::lint_name)]` for intentional suppressions — always add a comment explaining why.
- Configure `rustfmt.toml` for team preferences: `max_width`, `use_field_init_shorthand`, `edition`.
- Run `cargo clippy --all-targets --all-features` to lint test code and feature-gated code too.