RS.CLIPPY.NEEDLESS_OPTION_AS_DEREF

No-op use of `deref` or `deref_mut` method to `Option`.

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

What it does

Checks for no-op uses of Option::{as_deref, as_deref_mut}, for example, Option<&T>::as_deref() returns the same type.

Why is this bad?

Redundant code and improving readability.

Example

let a = Some(&1);
let b = a.as_deref(); // goes from Option<&i32> to Option<&i32>

Use instead:

let a = Some(&1);
let b = a;