]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/src/docs/match_result_ok.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / match_result_ok.txt
1 ### What it does
2 Checks for unnecessary `ok()` in `while let`.
3
4 ### Why is this bad?
5 Calling `ok()` in `while let` is unnecessary, instead match
6 on `Ok(pat)`
7
8 ### Example
9 ```
10 while let Some(value) = iter.next().ok() {
11 vec.push(value)
12 }
13
14 if let Some(value) = iter.next().ok() {
15 vec.push(value)
16 }
17 ```
18 Use instead:
19 ```
20 while let Ok(value) = iter.next() {
21 vec.push(value)
22 }
23
24 if let Ok(value) = iter.next() {
25 vec.push(value)
26 }
27 ```