rust-doctor · Error Handling
unwrap-in-production
Flags `.unwrap()` and `.expect()` calls outside of test code. These calls panic at runtime if the value is `None` or `Err`, crashing your application.
- Severity
- warning
- Confidence
- medium
- Analyzer
- syn-ast
- Default policy
- Enabled
Tags
Framework requirements
No framework requirement.
Limitations
- Syntactic matching cannot distinguish a provably infallible unwrap from a risky one.
Remediation
Use the `?` operator to propagate errors, or handle them with `match`, `if let`, `.unwrap_or()`, or `.unwrap_or_else()`.
Fix capability: guidance