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.
What
Enable
clippy::expect_usedin[lints.clippy].What it catches
Flags every
.expect()call on anOption/Result..expect()aborts theprocess 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 commandlayer.
Why it improves code quality
worktree-ioalready deniesclippy::panicand is moving towards "nouncontrolled aborts" as a project-wide standard.
.expect()is the othercommon 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
todoin this repo's lint config.This issue was opened by the Clippy lint improvements → issue + PR (Rust repos) → Slack routine of moadim.