summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_option_as_deref.txt
blob: 226396c97ac49f8ce715dcee362d3ab644362143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### 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;
```