What
Enable the clippy::unnested_or_patterns lint (from the pedantic group) at deny level in core/Cargo.toml's [lints.clippy] table.
What it catches
unnested_or_patterns flags patterns where multiple variants of an or-pattern share the same outer constructor and could be collapsed into a single nested or-pattern. For example:
// flagged
match x {
Some(1) | Some(2) => ...,
}
// preferred
match x {
Some(1 | 2) => ...,
}
It applies to any nested or-pattern position — enum tuple variants, struct fields, tuples, slices, references, etc.
Why it improves code quality
- Less repetition — the shared constructor is written once, not per alternative.
- More readable — the real variation between arms is surfaced at the inner level instead of being buried under a repeated wrapper.
- Easier to extend — adding another alternative is a one-token change inside the nested or-pattern.
This matches the repo's existing incremental clippy ratchet (every PR promotes one more lint to deny). The current codebase has zero violations, so enabling it is a clean, no-fix guard that prevents nested-or-pattern duplication from creeping in going forward.
This issue was opened by the Clippy lint improvements → issue + PR (Rust repos) → Slack routine of moadim.
What
Enable the
clippy::unnested_or_patternslint (from thepedanticgroup) atdenylevel incore/Cargo.toml's[lints.clippy]table.What it catches
unnested_or_patternsflags patterns where multiple variants of an or-pattern share the same outer constructor and could be collapsed into a single nested or-pattern. For example:It applies to any nested or-pattern position — enum tuple variants, struct fields, tuples, slices, references, etc.
Why it improves code quality
This matches the repo's existing incremental clippy ratchet (every PR promotes one more lint to
deny). The current codebase has zero violations, so enabling it is a clean, no-fix guard that prevents nested-or-pattern duplication from creeping in going forward.This issue was opened by the Clippy lint improvements → issue + PR (Rust repos) → Slack routine of moadim.