RS.CLIPPY.OK_EXPECT

Using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result

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

What it does

Checks for usage of ok().expect(..).

Why is this bad?

Because you usually call expect() on the Result directly to get a better error message.

Example

x.ok().expect("why did I do this again?");

Use instead:

x.expect("why did I do this again?");