-
Notifications
You must be signed in to change notification settings - Fork 96
clippy: enable unwrap_used + expect_used workspace lints #446
Copy link
Copy link
Closed
Labels
area:ciContinuous integration and release checksContinuous integration and release checksenhancementNew feature or requestNew feature or requestpriority:mediumUseful next work but not immediately release-blockingUseful next work but not immediately release-blockingrustPull requests that update rust codePull requests that update rust codetype:tech-debtEngineering debt and maintainability workEngineering debt and maintainability work
Milestone
Metadata
Metadata
Assignees
Labels
area:ciContinuous integration and release checksContinuous integration and release checksenhancementNew feature or requestNew feature or requestpriority:mediumUseful next work but not immediately release-blockingUseful next work but not immediately release-blockingrustPull requests that update rust codePull requests that update rust codetype:tech-debtEngineering debt and maintainability workEngineering debt and maintainability work
Type
Fields
Give feedbackNo fields configured for Maintenance.
Projects
StatusShow more project fields
Done
The workspace clippy configuration in `Cargo.toml` restricts `todo`, `unimplemented`, `unreachable`, and `get_unwrap`, but does NOT restrict `unwrap_used` or `expect_used`. A panic audit shows ~4,300 `.unwrap()` / `.expect()` call sites across the workspace; the vast majority are in test code and a few production sites are proven-safe by local invariants.
The discipline is working today, but it depends on reviewer enforcement. Enabling the two restriction lints turns the discipline into a compiler-enforced ratchet: new panics in production code require an explicit `#[expect(clippy::unwrap_used, reason = "...")]` annotation, which is reviewable.
Scope
```toml
unwrap_used = "warn"
expect_used = "warn"
```
```rust
#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
```
or via per-test-module `#[expect(...)]` blocks. Either approach is fine; pick the one the existing restriction lints already use elsewhere.
Why this matters
Verification