about summary refs log tree commit diff
path: root/src/docs/explicit_iter_loop.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/explicit_iter_loop.txt')
-rw-r--r--src/docs/explicit_iter_loop.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/docs/explicit_iter_loop.txt b/src/docs/explicit_iter_loop.txt
new file mode 100644
index 00000000000..cabe72e91d0
--- /dev/null
+++ b/src/docs/explicit_iter_loop.txt
@@ -0,0 +1,25 @@
+### What it does
+Checks for loops on `x.iter()` where `&x` will do, and
+suggests the latter.
+
+### Why is this bad?
+Readability.
+
+### Known problems
+False negatives. We currently only warn on some known
+types.
+
+### Example
+```
+// with `y` a `Vec` or slice:
+for x in y.iter() {
+    // ..
+}
+```
+
+Use instead:
+```
+for x in &y {
+    // ..
+}
+```
\ No newline at end of file