diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/src/docs/needless_for_each.txt | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/tools/clippy/src/docs/needless_for_each.txt b/src/tools/clippy/src/docs/needless_for_each.txt deleted file mode 100644 index 9ae6dd360..000000000 --- a/src/tools/clippy/src/docs/needless_for_each.txt +++ /dev/null @@ -1,24 +0,0 @@ -### What it does -Checks for usage of `for_each` that would be more simply written as a -`for` loop. - -### Why is this bad? -`for_each` may be used after applying iterator transformers like -`filter` for better readability and performance. It may also be used to fit a simple -operation on one line. -But when none of these apply, a simple `for` loop is more idiomatic. - -### Example -``` -let v = vec![0, 1, 2]; -v.iter().for_each(|elem| { - println!("{}", elem); -}) -``` -Use instead: -``` -let v = vec![0, 1, 2]; -for elem in v.iter() { - println!("{}", elem); -} -```
\ No newline at end of file |