Summary
Enable the Clippy lint clippy::manual_let_else at deny, continuing the incremental clippy ratchet documented in core/Cargo.toml ([lints.clippy]).
What it catches
A diverging match or if let whose only purpose is to bind a value (and otherwise return/break/continue/panic) — e.g.
let value = match opt {
Some(v) => v,
None => return,
};
It flags those and suggests the dedicated let ... else { ... } form:
let Some(value) = opt else { return };
Why it improves code quality
- Less boilerplate, clearer happy path — the binding and its divergence are stated once instead of a multi-line
match that buries the main flow.
- Scope clarity —
let ... else keeps the bound name in the enclosing scope by construction; the manual form is easy to get subtly wrong.
- Consistency — pairs with the existing
option_if_let_else deny and the project's broader "prefer the dedicated control-flow form" stance.
Scope
- One rule only:
manual_let_else = "deny" in core/Cargo.toml.
- The codebase currently has zero violations, so this lands clean as a guard against future regressions —
cargo clippy --all-targets and cargo test both pass.
This issue was opened by the Add lint rule → issue + PR (owned repos + my orgs) → Slack routine of moadim. cc @tupe12334
Summary
Enable the Clippy lint
clippy::manual_let_elseatdeny, continuing the incremental clippy ratchet documented incore/Cargo.toml([lints.clippy]).What it catches
A diverging
matchorif letwhose only purpose is to bind a value (and otherwisereturn/break/continue/panic) — e.g.It flags those and suggests the dedicated
let ... else { ... }form:Why it improves code quality
matchthat buries the main flow.let ... elsekeeps the bound name in the enclosing scope by construction; the manual form is easy to get subtly wrong.option_if_let_elsedeny and the project's broader "prefer the dedicated control-flow form" stance.Scope
manual_let_else = "deny"incore/Cargo.toml.cargo clippy --all-targetsandcargo testboth pass.This issue was opened by the Add lint rule → issue + PR (owned repos + my orgs) → Slack routine of moadim. cc @tupe12334