[PATCH 2/5] CLAUDE.md: Add Rust code quality requirements
Luis Chamberlain <[email protected]> Fri, 17 Oct 2025 19:32:14 -0700
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
Document mandatory use of cargo fmt and cargo clippy for all Rust code in kdevops workflows. This ensures consistent code quality and adherence to Linux kernel Rust standards. Quality checklist for Rust code: - cargo fmt: Auto-format using .rustfmt.toml configuration - cargo clippy: Lint with -D warnings (treat warnings as errors) - Fix all clippy warnings before committing Common clippy fixes include removing unnecessary casts, using .flatten() instead of manual if let Ok patterns, and removing unused imports. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <[email protected]> --- CLAUDE.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index a72836a2..1ca86b9e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -481,6 +481,28 @@ The style checker will identify: Fix all reported issues before submitting your work. The `make style` command checks both file whitespace and the most recent commit message format. +### Rust Code Quality + +For Rust code in kdevops (workflows/rcloud, etc.), ALWAYS run both: + +```bash +# Format code using Linux kernel rustfmt standards +cargo fmt + +# Check for common mistakes and idioms +cargo clippy --all-targets --all-features -- -D warnings +``` + +**Rust Quality Checklist**: +- ✅ Run `cargo fmt` to auto-format code according to .rustfmt.toml +- ✅ Run `cargo clippy` with `-D warnings` (treat warnings as errors) +- ✅ Fix ALL clippy warnings before committing +- ✅ Common clippy fixes: remove unnecessary casts, use `.flatten()` instead of manual `if let Ok`, remove unused imports + +The install-rust-deps role provides both cargo/rustc and the .rustfmt.toml +configuration from the Linux kernel, ensuring consistent Rust code quality +across all kdevops workflows. + ### Automatic Whitespace Fixing For convenience, you can automatically fix whitespace issues using: -- 2.51.0