Skip to content

Enable clippy::manual_let_else lint #162

Description

@tupe12334

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 claritylet ... 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions