RS.CLIPPY.UNNECESSARY_UNWRAP

Checks for calls of `unwrap[_err]()` that cannot 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: unnecessary_unwrap. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for calls of unwrap[_err]() that cannot fail.

Why is this bad?

Using if let or match is more idiomatic.

Example

if option.is_some() {
    do_something_with(option.unwrap())
}

Could be written:

if let Some(value) = option {
    do_something_with(value)
}