clap-rs/clap

The canonical "well-curated Rust library workspace" — clap's entire workspace-metadata contract maps to ~12 alint rules.

Narrative
Other case studies
Rules
70
Last revalidated
Engineering reference
README on GitHub · .alint.yml

Why this case study matters

clap is the canonical “well-curated Rust library workspace” — five published members (clap_builder, clap_derive, clap_complete, clap_mangen, clap_lex) plus the umbrella clap facade and clap_bench, all sharing one [workspace.package] block for license, edition, MSRV, repository, and include glob.

The structural surface is small but dense: ~30 distinct checks across CI workflows, pre-commit hooks, cargo-release config, and the workspace metadata itself. Roughly 65% maps directly to declarative alint rules, 5% shells out via command: to typos / cffconvert / cargo deny, and ~30% is deliberately out of alint’s scope (rustfmt, clippy, rustdoc, the Cargo-graph checks the Rust toolchain owns).

The fit is higher than rust-lang/rust because clap doesn’t carry its own custom AST-aware linter — the structural surface is exactly the “metadata pinning + manifest hygiene” layer alint targets.

Headline catch

clap’s entire workspace-metadata contract maps to ~12 alint rules. One Cargo.toml concentrates almost every structural fact about the workspace:

Each of those 12 invariants becomes one TOML-path rule. Drop in the five bundled rulesets (oss-baseline, rust, monorepo/cargo-workspace, ci/github-actions, hygiene/no-tracked-artifacts) for the standard hygiene layer, and the 24-rule starter config replaces every structural assertion clap makes about its own workspace.

Where alint earns its keep here

clap is the complementary case study to kubernetes / rust-lang/rust: those are the “huge polyglot monorepo” stories. clap is the “small, disciplined, every-decision-deliberate” story. Together the three span the adoption spectrum.

Use it as the positive baseline for the launch positioning:

“clap is what a clean Rust library workspace looks like, and alint can describe its entire structural-validation surface in 24 lines of YAML. If your Rust workspace is messier than clap’s, alint is probably the cheapest way to surface that delta.”

The pitch is discoverability + onboarding: a contributor runs alint check once and gets the same structural verdict that 5 separate tools (committed, typos, cffconvert, cargo deny, pre-commit) plus the bundled rules cover today, in one declarative file with grep-able rule IDs.

clap also confirms two cross-file rule-kind candidates by demand: the per-crate metadata identity check (every clap_* member’s categories[0] resolves to the same value) is now absorbed into cross_file_value_equals (10 sources, past-saturation, v0.10 ship-target). The pre-release-replacements regex sanity gap is narrower (cargo-release-specific) and stays on the v0.10 design candidate list.

Future story angles

The factual engineering writeup (tooling inventory, mapping table, gap catalogue, validation status footer) lives in the public alint repo at github.com/asamarts/alint/tree/main/examples/clap-rs-clap/README.md.