summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/needless_option_take.txt
blob: 6bac65a13b5b883e20d79764769d6f38f0b521be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
### What it does
Checks for calling `take` function after `as_ref`.

### Why is this bad?
Redundant code. `take` writes `None` to its argument.
In this case the modification is useless as it's a temporary that cannot be read from afterwards.

### Example
```
let x = Some(3);
x.as_ref().take();
```
Use instead:
```
let x = Some(3);
x.as_ref();
```