Rust Tooling Profile
The broad Rust tooling profile gathers lints, docs, release, CI, performance, and agent workflow checks in one place. Use it as a menu of mechanical supports, not as a substitute for project-specific risk judgment.
Purpose
Use mechanical tooling to support durable Rust rules where tools can catch drift, make review cheaper, or encode project policy. Tooling should make the preferred path easier without pretending that lints and checks replace design judgment.
Supported Principles
Rust Lints
- Use
unsafe_code = "forbid"for crates that should remain safe Rust. - Use
undocumented_unsafe_blockswhen unsafe is intentional and every block needs a localSAFETY:explanation. - Use
missing_docsfor library crates where public documentation is part of the API contract. - Consider
missing_debug_implementationsfor public library types where diagnostics matter. - Use
unfulfilled_lint_expectationswith#[expect(..., reason = "...")]so stale suppressions are visible. - Enable Clippy policy selectively when the lint encodes a real project rule rather than generic preference churn.
Formatting
- Run
cargo fmt --checkin CI. - Use
rustfmt.tomlonly for stable house choices the project actually wants to enforce. - Prefer module-based imports and
name.rsfiles over broad single-import lists andmod.rslayouts unless local conventions differ. - Use
markdownlint-cli2for Markdown line length, fences, blank lines around blocks, and ordered list style.
Cargo and Rustdoc Checks
- Run
cargo clippy --all-targets --all-featureswhen feature cost is acceptable. - Run
cargo testorcargo nextestfor normal correctness gates. - Run
cargo test --docfor public examples and Rustdoc compatibility. - Run
cargo doc --no-depswithRUSTDOCFLAGS="-D warnings"when Rustdoc quality matters. - Use
cargo doc --openwhen rendered docs should be easy for a maintainer to inspect. - Use docs.rs-parity builds for release-facing docs, including the project's docs.rs-equivalent
feature set,
cargo +nightly doc,RUSTDOCFLAGS="--cfg docsrs", and--no-depswhere appropriate.
API and Release Checks
- Use
cargo-semver-checksfor semver-relevant public API changes. - Use
cargo public-apito snapshot or inspect public API shape. - Use
cargo package --listandcargo packageto inspect release artifacts. - Use
cargo tree -e featuresandcargo metadatato audit feature and optional dependency shape. - Use
cargo minimal-versions check --director direct minimal-version resolution to validate declared direct dependency minimums. - Configure dependency automation with
versioning-strategy: increase-if-necessarywhen the goal is compatible lockfile refresh rather than raising manifest minimums.
Matrix and Heavy Checks
- Use
cargo hackfor no-default, each-feature, all-features, and selected feature combinations. - Use pinned toolchain CI or MSRV checks when MSRV is part of the public contract.
- Use fuzzing or property tests for parsers, decoders, state machines, and untrusted input.
- Use
criterion, repeatedhyperfine, or saved benchmark scripts for performance claims.
Agentic Tooling
- Prefer Git-formatted diffs when agents need to interpret patch output.
- Configure
JJ_PAGER=catfor unattended jj command execution. - Use repo-scoped jj aliases when the repo topology is known.
- Add
AGENTS.override.mdto global Git excludes for local-only Codex notes that must not be committed. - Turn repeated feedback into scripts, lints, templates, generated checks, or review checklists before relying on prompts.
Limits
Do not add tools just to look rigorous. Each mechanism should identify the rule it supports, the failure it catches, and the cost it adds. Heavy checks belong in release or targeted validation when they would make the normal edit loop too slow.