]> git.lizzy.rs Git - rust.git/blob - src/docs/needless_option_as_deref.txt
Add iter_kv_map lint
[rust.git] / src / docs / needless_option_as_deref.txt
1 ### What it does
2 Checks for no-op uses of `Option::{as_deref, as_deref_mut}`,
3 for example, `Option<&T>::as_deref()` returns the same type.
4
5 ### Why is this bad?
6 Redundant code and improving readability.
7
8 ### Example
9 ```
10 let a = Some(&1);
11 let b = a.as_deref(); // goes from Option<&i32> to Option<&i32>
12 ```
13
14 Use instead:
15 ```
16 let a = Some(&1);
17 let b = a;
18 ```