Skip to content

Enable clippy::expect_used lint #97

Description

@tupe12334

What

Enable clippy::expect_used in [lints.clippy].

What it catches

Flags every .expect() call on an Option/Result. .expect() aborts the
process immediately with no chance to recover, log structured context, or let
a caller decide how to handle the failure — unlike propagating an
anyhow::Result, which this crate already uses pervasively in its command
layer.

Why it improves code quality

worktree-io already denies clippy::panic and is moving towards "no
uncontrolled aborts" as a project-wide standard. .expect() is the other
common panic vector: it's easy to reach for during development and easy to
forget to migrate to proper error handling. Catching it at lint time means
new fallible call sites get a real anyhow::Result (with a .context(...)
message) instead of a bare process abort, and any call site that's genuinely
an intentional, documented panic gets a localized #[allow] that makes the
"this can't happen" claim explicit and reviewable instead of implicit.

This follows the same pattern already established for panic, dbg_macro,
and todo in this repo's lint config.

This issue was opened by the Clippy lint improvements → issue + PR (Rust repos) → Slack routine of moadim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions