Skip to content

chore(lint): enable clippy::panic_in_result_fn#96

Open
tupe12334 wants to merge 1 commit into
mainfrom
clippy/enable-panic_in_result_fn
Open

chore(lint): enable clippy::panic_in_result_fn#96
tupe12334 wants to merge 1 commit into
mainfrom
clippy/enable-panic_in_result_fn

Conversation

@tupe12334

Copy link
Copy Markdown
Member

Summary

Enable the clippy::panic_in_result_fn restriction lint, which flags panic!, todo!, unimplemented!, and unreachable! calls inside functions that return Result or Option.

Why

When a function's return type already models fallibility, an internal panic bypasses structured error propagation — the process crashes instead of returning Err(_)/None for the caller to handle. This lint enforces the invariant that Result/Option-returning functions stay within the type system's error-handling contract.

What changed

Added to [lints.clippy] in Cargo.toml:

# Prevent panic!/todo!/unimplemented!/unreachable! inside Result/Option-returning
# functions. When a function already signals fallibility via its return type,
# an internal panic bypasses structured error propagation and crashes the
# process instead of returning Err(_)/None for the caller to handle.
panic_in_result_fn = "deny"

The codebase has zero violations today — this commit locks in that clean state and prevents future regressions.

Verification

cargo clippy --all-targets passes with no warnings or errors. Pre-push hook (clippy + build + 100% coverage) also passed.

Closes #95


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

Deny panic!/todo!/unimplemented!/unreachable! inside functions that return
Result or Option. When a function's return type already models failure,
an internal panic bypasses structured error propagation and crashes the
process instead of returning Err(_)/None for callers to handle.

The codebase has zero violations today; this commit locks in that clean
state and prevents future regressions.

Closes #95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable clippy::panic_in_result_fn lint

1 participant