]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/needless_option_take.txt
Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk
[rust.git] / src / tools / clippy / src / docs / needless_option_take.txt
1 ### What it does
2 Checks for calling `take` function after `as_ref`.
3
4 ### Why is this bad?
5 Redundant code. `take` writes `None` to its argument.
6 In this case the modification is useless as it's a temporary that cannot be read from afterwards.
7
8 ### Example
9 ```
10 let x = Some(3);
11 x.as_ref().take();
12 ```
13 Use instead:
14 ```
15 let x = Some(3);
16 x.as_ref();
17 ```