with one click
rmc-enum-variants
Inspect Rust enum variants.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Inspect Rust enum variants.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Preview a Rust symbol rename — exact reference set & refactor probe.
Audit a Rust crate's public API.
Enforce Rust crate-edge rules.
Audit Rust attributes and doc-comments.
Rust fn-level call graphs.
Task-conditioned workspace subgraph — nodes, edges, hierarchy.
| name | rmc-enum-variants |
| description | Inspect Rust enum variants. |
| argument-hint | <enum-qualified-name> |
| allowed-tools | Read, mcp__rust-code-mcp__* |
Variants of an enum are first-class — list them, then per-variant fan-in
via who_uses(target=Enum::Variant). Scope: single enum.
For workspace-wide variant-duplicate detection across enums, use
rmc-semantic-overlaps. For attribute audits like #[non_exhaustive],
use rmc-attribute-audit.
build_hypergraph(directory=<absolute-path>)
index_codebase(directory=<absolute-path>) # only for Step 3 (semantic_overlaps)
enum_variants(directory=..., target=<crate>::E)
One row per variant in source order with display_name,
qualified_name, (file, span). Useful for auditing the variant set
without parsing the source manually.
For each variant:
who_uses(directory=..., target=<crate>::E::Variant)
who_uses_summary(directory=..., target=<crate>::E::Variant)
Every pattern-match / construction site for the variant. Sort by total → "which states actually carry the load?".
semantic_overlapssemantic_overlaps(directory=..., item_kind="EnumVariant", threshold=0.95)
Variants whose source bytes hash identically (e.g. unit Error variant
duplicated across 6 different enums) cluster together. The signal that
the same logical state was modeled as separate variants on different
enums — convergent enum design.
For an enum E, compute fan-in for every variant. Heaviest-used variants surface as the load-bearing states; rarely-used variants are candidates for collapse / split into a different type.
Variants with empty who_uses are dead. The constructor never executes;
the pattern-match arm never matches. Either:
#[non_exhaustive], which preserves the variant for downstream
pattern matching even if no caller in this workspace uses it).semantic_overlaps(item_kind="EnumVariant", threshold=0.95) clusters
variants whose source is identical. Each cluster is a candidate for
harmonization — extract a shared base, introduce a trait, or collapse
the convergent enums into one.
| Finding | Action |
|---|---|
Empty who_uses for a variant | Dead variant; remove (mind #[non_exhaustive]) |
| One variant carries 90% of fan-in | Other variants may be over-modeled — consider flattening |
| Variants are mostly unused unit variants | Collapse into a flag / single variant |
| Same variant duplicated across 3+ enums | Convergent design — harmonize |
| Variant with all-Test fan-in | Test-only state; gate or remove |
| Audit | Invocation |
|---|---|
| List variants | enum_variants(target=E) |
| Per-variant fan-in | who_uses_summary(target=E::Variant) per variant |
| Convergence | semantic_overlaps(item_kind="EnumVariant", threshold=0.95) |
| Cross-reference attributes | item_attributes(target=E) for #[non_exhaustive] etc. |
Enum: <crate>::E
Variants: <n>
Per-variant fan-in (sorted desc):
E::A — <n> uses (Test: <t>, Other: <o>)
E::B — <n> uses
E::C — 0 uses (dead?)
Attribute check: <#[non_exhaustive] present | absent>
Convergent variants (from semantic_overlaps): <list of clusters>
Recommendation: <keep | remove E::C | flatten | harmonize-with-other-enums>
= 5 part of Variant = 5) are present
only when the source declared them — implicit discriminants aren't
computed.Variant { a: T, b: U } returns one row for the variant; fields are
not graph nodes. To inspect fields, drop to read_file_content at the
variant's span.who_uses(target=E::Variant) resolves correctly for direct variant
references, but pattern-matches that bind via _ or .. may not
carry an explicit reference to the variant — the count is a lower
bound.