diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/manual_flatten.txt | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/tools/clippy/src/docs/manual_flatten.txt b/src/tools/clippy/src/docs/manual_flatten.txt deleted file mode 100644 index 62d5f3ec9..000000000 --- a/src/tools/clippy/src/docs/manual_flatten.txt +++ /dev/null @@ -1,25 +0,0 @@ -### What it does -Check for unnecessary `if let` usage in a for loop -where only the `Some` or `Ok` variant of the iterator element is used. - -### Why is this bad? -It is verbose and can be simplified -by first calling the `flatten` method on the `Iterator`. - -### Example - -``` -let x = vec![Some(1), Some(2), Some(3)]; -for n in x { - if let Some(n) = n { - println!("{}", n); - } -} -``` -Use instead: -``` -let x = vec![Some(1), Some(2), Some(3)]; -for n in x.into_iter().flatten() { - println!("{}", n); -} -```
\ No newline at end of file |