rust-discipline
Installation
SKILL.md
Rust Discipline
Review rules for Rust API shape: pub and pub(crate) signatures, struct definitions, trait
bounds, and trait impls. Each rule targets a defect that compiles and then breaks a caller, a
downstream crate, or a later release. Apply the rules to every changed signature in the diff.
| Severity | Meaning |
|---|---|
| CRITICAL | Blocks the merge. The defect is silent, or it breaks downstream code and a release cannot undo it. |
| WARNING | Fix it, or write a one-line justification in the diff. |
Verify
| Claim | Check | What a green result does not prove |
|---|---|---|
| No lint regression | cargo clippy --all-targets --locked -- -D warnings |
Clippy denies derived_hash_with_manual_eq by default. It does not see two manual Hash and PartialEq impls that disagree. |
| A public API change keeps SemVer | cargo semver-checks check-release on a published crate, if it is installed. Pass --baseline-rev <rev> for an unpublished one. |
Measured with cargo-semver-checks 0.50.0 on rustc 1.98.1: it flags a new variant on an exhaustive enum, a new #[non_exhaustive], a new pub field on a literal-constructible struct, and a lost Send or Sync. It does not flag &str changed to impl AsRef<str>, a new blanket impl on a public trait, or a new provided trait method whose name can collide (E0034). Review those three by hand. |
| A bound accepts every promised caller | A test that passes each caller shape the API promises. For a for<'a> bound, pass the function or method path itself. |
Only the shapes the test passes. |
A hash key keeps the Eq/Hash contract |
A test that inserts through one form and looks up through the other | Only the forms the test uses. |