RS.CLIPPY.MANUAL_UNWRAP_OR

Finds patterns that can be encoded more concisely with `Option::unwrap_or` or `Result::unwrap_or`

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: manual_unwrap_or. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Finds patterns that reimplement Option::unwrap_or or Result::unwrap_or.

Why is this bad?

Concise code helps focusing on behavior instead of boilerplate.

Example

let foo: Option<i32> = None;
match foo {
    Some(v) => v,
    None => 1,
};

Use instead:

let foo: Option<i32> = None;
foo.unwrap_or(1);