summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/suspicious_map.txt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/src/docs/suspicious_map.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/suspicious_map.txt b/src/tools/clippy/src/docs/suspicious_map.txt
new file mode 100644
index 000000000..d8fa52c43
--- /dev/null
+++ b/src/tools/clippy/src/docs/suspicious_map.txt
@@ -0,0 +1,13 @@
+### What it does
+Checks for calls to `map` followed by a `count`.
+
+### Why is this bad?
+It looks suspicious. Maybe `map` was confused with `filter`.
+If the `map` call is intentional, this should be rewritten
+using `inspect`. Or, if you intend to drive the iterator to
+completion, you can just use `for_each` instead.
+
+### Example
+```
+let _ = (0..3).map(|x| x + 2).count();
+``` \ No newline at end of file