RS.CLIPPY.PANICKING_UNWRAP
Checks for calls of `unwrap[_err]()` that will always fail
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: panicking_unwrap. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for calls of unwrap[_err]() that will always fail.
Why is this bad?
If panicking is desired, an explicit panic!() should be used.
Known problems
This lint only checks if conditions not assignments.
So something like let x: Option<()> = None; x.unwrap(); will not be recognized.
Example
if option.is_none() {
do_something_with(option.unwrap())
}
This code will always panic. The if condition should probably be inverted.