rust-cargo-hygiene
Audit Cargo.toml, feature flags, MSRV, lint configuration, and other crate-level settings for clarity, semver discipline, and release readiness.
Manifest mistakes break downstream builds quietly: an unintended default-features = true, a missing dev-only dependency move, or a slipping MSRV often only surfaces on a user's machine. Treat the manifest as part of the public API.
Scope
Focus on newly added or modified files such as:
Cargo.toml (root, workspace, and per-crate)
Cargo.lock only when the lock file is committed (binary crates or workspace policy)
clippy.toml, rustfmt.toml, .cargo/config.toml
- crate-root attributes (
#![deny(...)], #![warn(...)], #![forbid(...)])
rust-toolchain.toml
Scope Modes
Default mode:
- Audit newly added or modified manifests, toolchain files, lint configuration, and crate-root attributes.
- Ignore unrelated unchanged configuration unless it affects the changed manifest surface.
Whole-repo baseline mode:
- Use when the user explicitly says "whole repo", "entire repo", "baseline audit", or similar.
- Audit all workspace manifests, committed lockfile policy, toolchain files, Cargo config, lint configuration, docs.rs metadata, and crate-root lint attributes.
- Prioritize findings by release risk, semver impact, MSRV drift, feature breakage, unsafe/lint policy enforcement, and dependency correctness.
- Do not require fixing every historical hygiene issue in one pass; separate release blockers from cleanup follow-ups.
Review goals
1. Package metadata
Check:
name, version, edition, rust-version, description, license, repository, documentation, homepage, categories, keywords, and readme are populated where appropriate for a published crate
version follows semver and matches the changelog entry being prepared, when the task is explicitly release-preparation work
edition is set explicitly and matches the rest of the workspace
rust-version is present for any published crate that wants a meaningful MSRV
license field agrees with LICENSE/LICENSE-* files in the repository
Version-change policy:
- Do not automatically bump
Cargo.toml package versions, lockfile package versions, README dependency snippets, or related version references during ordinary cargo-hygiene, feature, fix, or review work.
- Treat version bumps as maintainer-driven release work. Only recommend or perform them when the user explicitly asks for release/version-bump work or is following the repository's release procedure.
- If changed code appears semver-sensitive, report the semver implication as a finding or release note. Leave the actual version update to the maintainer unless explicitly instructed otherwise.
Flag:
- missing or stale metadata for a crate about to publish
- mismatched
version between manifest and CHANGELOG.md
- license fields that disagree with the repository's license files
2. Dependencies
Check:
- runtime, build, and dev dependencies live in the right tables
- version specifiers are realistic: avoid
*, avoid pinning to exact patch versions for libraries
default-features = false is set for dependencies that pull in unwanted features by default
- features requested per dependency match what the code actually uses
- optional dependencies are gated through the crate's own feature flags
- workspace inheritance (
workspace = true) is used consistently to avoid drift between workspace members
path and git dependencies are intentional for a published crate (usually replaced by version requirements before release)
Flag:
- runtime use of items only enabled via dev/test
- accidental
default-features = true on heavy ecosystem crates (e.g., tokio, reqwest, serde)
- duplicated dependencies between root and workspace members at different versions
- transitive features enabled implicitly that change behavior
- direct dependencies on yanked or deprecated versions
3. Feature flag design
Check:
- features are additive: enabling a feature should not remove or replace functionality
- default features make sense for the broadest reasonable consumer
- internal "implementation detail" features are documented or prefixed (for example
_internal-*) so they are clearly unstable
- features that flip safety, dependencies, or runtime behavior are clearly named
- removing or renaming a public feature is treated as a breaking change
Flag:
- non-additive features
- features that silently change MSRV
- public feature names that leak third-party crate names callers should not depend on
- feature combinations that fail to compile
4. MSRV and toolchain
Check:
rust-version is consistent with the highest stable feature actually used
- CI tests against the declared MSRV
rust-toolchain.toml is intentional and matches contributor expectations
- bumping MSRV is treated as at least a minor version change for libraries
Flag:
- nightly-only features used in a crate that claims a stable MSRV
- silent MSRV drift through new dependency versions
5. Lints and style configuration
Check:
- the
[lints] table or crate-root attributes set a coherent baseline
#![forbid(unsafe_code)] (or [lints.rust] unsafe_code = "forbid") is set when the project's policy forbids unsafe; this is the right place for that policy, not a code review checklist
clippy.toml rules are documented when non-default
rustfmt.toml matches the project's formatting expectations
#![deny(missing_docs)], #![deny(rustdoc::broken_intra_doc_links)], and similar are configured for published crates
- lint levels are consistent across workspace members through the workspace
[lints] table
Flag:
- unsafe-policy crates that lack
forbid(unsafe_code) enforcement
- per-file
#[allow(...)] for lints that should be allowed crate-wide (or vice versa)
- workspace members that override workspace lint settings without justification
6. Workspace and publishing
Check:
[workspace] inheritance covers shared metadata, dependencies, and lints
publish = false is set for internal-only crates
exclude/include are set when the published tarball needs trimming
[package.metadata.docs.rs] is configured when feature flags affect docs.rs builds
- workspace members that should not be published explicitly opt out
7. Release readiness
Before a release, also check:
CHANGELOG.md has an entry that matches the manifest version
- documentation has been updated to match the new version before publishing; crates.io does not allow republishing documentation without a version bump
- version references are consistent only within an explicit release workflow; do not introduce the version bump yourself unless the user requested that release step
cargo publish --dry-run would succeed with the current manifest
- yanked or deprecated dependencies are not present
- MSRV declared in
Cargo.toml matches the value tested in CI
Output Format
Summary
- PASS
- NEEDS IMPROVEMENT
- FAIL
Findings
- Manifest, feature, MSRV, lint, or workspace issues with locations
Required Fixes
- Metadata corrections
- Dependency reorganization or feature changes
- MSRV/toolchain alignment
- Lint configuration changes (including
forbid(unsafe_code) when policy requires it)
- Workspace or publish setting changes
Optional Improvements
- Future-friendly metadata, doc, or feature suggestions
Source: acgetchell/dotfiles — distributed by TomeVault.
1---2name: acgetchell-dotfiles-rust-cargo-hygiene3description: rust-cargo-hygiene4---56# rust-cargo-hygiene78Audit `Cargo.toml`, feature flags, MSRV, lint configuration, and other crate-level settings for clarity, semver discipline, and release readiness.910Manifest mistakes break downstream builds quietly: an unintended `default-features = true`, a missing dev-only dependency move, or a slipping MSRV often only surfaces on a user's machine. Treat the manifest as part of the public API.1112## Scope1314Focus on newly added or modified files such as:1516- `Cargo.toml` (root, workspace, and per-crate)17- `Cargo.lock` only when the lock file is committed (binary crates or workspace policy)18- `clippy.toml`, `rustfmt.toml`, `.cargo/config.toml`19- crate-root attributes (`#![deny(...)]`, `#![warn(...)]`, `#![forbid(...)]`)20- `rust-toolchain.toml`2122### Scope Modes2324Default mode:25- Audit newly added or modified manifests, toolchain files, lint configuration, and crate-root attributes.26- Ignore unrelated unchanged configuration unless it affects the changed manifest surface.2728Whole-repo baseline mode:29- Use when the user explicitly says "whole repo", "entire repo", "baseline audit", or similar.30- Audit all workspace manifests, committed lockfile policy, toolchain files, Cargo config, lint configuration, docs.rs metadata, and crate-root lint attributes.31- Prioritize findings by release risk, semver impact, MSRV drift, feature breakage, unsafe/lint policy enforcement, and dependency correctness.32- Do not require fixing every historical hygiene issue in one pass; separate release blockers from cleanup follow-ups.3334## Review goals3536### 1. Package metadata3738Check:3940- `name`, `version`, `edition`, `rust-version`, `description`, `license`, `repository`, `documentation`, `homepage`, `categories`, `keywords`, and `readme` are populated where appropriate for a published crate41- `version` follows semver and matches the changelog entry being prepared, when the task is explicitly release-preparation work42- `edition` is set explicitly and matches the rest of the workspace43- `rust-version` is present for any published crate that wants a meaningful MSRV44- `license` field agrees with `LICENSE`/`LICENSE-*` files in the repository4546Version-change policy:4748- Do not automatically bump `Cargo.toml` package versions, lockfile package versions, README dependency snippets, or related version references during ordinary cargo-hygiene, feature, fix, or review work.49- Treat version bumps as maintainer-driven release work. Only recommend or perform them when the user explicitly asks for release/version-bump work or is following the repository's release procedure.50- If changed code appears semver-sensitive, report the semver implication as a finding or release note. Leave the actual version update to the maintainer unless explicitly instructed otherwise.5152Flag:5354- missing or stale metadata for a crate about to publish55- mismatched `version` between manifest and `CHANGELOG.md`56- license fields that disagree with the repository's license files5758### 2. Dependencies5960Check:6162- runtime, build, and dev dependencies live in the right tables63- version specifiers are realistic: avoid `*`, avoid pinning to exact patch versions for libraries64- `default-features = false` is set for dependencies that pull in unwanted features by default65- features requested per dependency match what the code actually uses66- optional dependencies are gated through the crate's own feature flags67- workspace inheritance (`workspace = true`) is used consistently to avoid drift between workspace members68- `path` and `git` dependencies are intentional for a published crate (usually replaced by version requirements before release)6970Flag:7172- runtime use of items only enabled via dev/test73- accidental `default-features = true` on heavy ecosystem crates (e.g., `tokio`, `reqwest`, `serde`)74- duplicated dependencies between root and workspace members at different versions75- transitive features enabled implicitly that change behavior76- direct dependencies on yanked or deprecated versions7778### 3. Feature flag design7980Check:8182- features are additive: enabling a feature should not remove or replace functionality83- default features make sense for the broadest reasonable consumer84- internal "implementation detail" features are documented or prefixed (for example `_internal-*`) so they are clearly unstable85- features that flip safety, dependencies, or runtime behavior are clearly named86- removing or renaming a public feature is treated as a breaking change8788Flag:8990- non-additive features91- features that silently change MSRV92- public feature names that leak third-party crate names callers should not depend on93- feature combinations that fail to compile9495### 4. MSRV and toolchain9697Check:9899- `rust-version` is consistent with the highest stable feature actually used100- CI tests against the declared MSRV101- `rust-toolchain.toml` is intentional and matches contributor expectations102- bumping MSRV is treated as at least a minor version change for libraries103104Flag:105106- nightly-only features used in a crate that claims a stable MSRV107- silent MSRV drift through new dependency versions108109### 5. Lints and style configuration110111Check:112113- the `[lints]` table or crate-root attributes set a coherent baseline114- `#![forbid(unsafe_code)]` (or `[lints.rust] unsafe_code = "forbid"`) is set when the project's policy forbids unsafe; this is the right place for that policy, not a code review checklist115- `clippy.toml` rules are documented when non-default116- `rustfmt.toml` matches the project's formatting expectations117- `#![deny(missing_docs)]`, `#![deny(rustdoc::broken_intra_doc_links)]`, and similar are configured for published crates118- lint levels are consistent across workspace members through the workspace `[lints]` table119120Flag:121122- unsafe-policy crates that lack `forbid(unsafe_code)` enforcement123- per-file `#[allow(...)]` for lints that should be allowed crate-wide (or vice versa)124- workspace members that override workspace lint settings without justification125126### 6. Workspace and publishing127128Check:129130- `[workspace]` inheritance covers shared metadata, dependencies, and lints131- `publish = false` is set for internal-only crates132- `exclude`/`include` are set when the published tarball needs trimming133- `[package.metadata.docs.rs]` is configured when feature flags affect docs.rs builds134- workspace members that should not be published explicitly opt out135136### 7. Release readiness137138Before a release, also check:139140- `CHANGELOG.md` has an entry that matches the manifest version141- documentation has been updated to match the new version before publishing; crates.io does not allow republishing documentation without a version bump142- version references are consistent only within an explicit release workflow; do not introduce the version bump yourself unless the user requested that release step143- `cargo publish --dry-run` would succeed with the current manifest144- yanked or deprecated dependencies are not present145- MSRV declared in `Cargo.toml` matches the value tested in CI146147## Output Format148149### Summary150- PASS151- NEEDS IMPROVEMENT152- FAIL153154### Findings155- Manifest, feature, MSRV, lint, or workspace issues with locations156157### Required Fixes158- Metadata corrections159- Dependency reorganization or feature changes160- MSRV/toolchain alignment161- Lint configuration changes (including `forbid(unsafe_code)` when policy requires it)162- Workspace or publish setting changes163164### Optional Improvements165- Future-friendly metadata, doc, or feature suggestions166167---168> Source: [acgetchell/dotfiles](https://github.com/acgetchell/dotfiles) — distributed by [TomeVault](https://tomevault.io).169<!-- tomevault:4.0:skill_md:2026-06-20 -->