about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-22 00:01:49 +0000
committerbors <bors@rust-lang.org>2022-06-22 00:01:49 +0000
commitbc0bf06718774082b7cfa5d26668bdd446cebb75 (patch)
tree1aab0aa6d58cea43ae1aac9e3a6648a073e5aee6
parent93c6f9ebed65eb4d77a5cf1ccf670cef3b1fca9e (diff)
parentdc7f2275937c3ae1a9ea0a82c4ed14fc3c686898 (diff)
downloadrust-bc0bf06718774082b7cfa5d26668bdd446cebb75.tar.gz
rust-bc0bf06718774082b7cfa5d26668bdd446cebb75.zip
Auto merge of #9017 - alex-semenyuk:while_let_on_iterator_doc_fix, r=giraffate
Example for `WHILE_LET_ON_ITERATOR`

changelog: none

example for `WHILE_LET_ON_ITERATOR`, using `for` instead of `while let`
-rw-r--r--clippy_lints/src/loops/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/clippy_lints/src/loops/mod.rs b/clippy_lints/src/loops/mod.rs
index 391de922e1e..fa7a8b10033 100644
--- a/clippy_lints/src/loops/mod.rs
+++ b/clippy_lints/src/loops/mod.rs
@@ -346,7 +346,14 @@ declare_clippy_lint! {
     ///
     /// ### Example
     /// ```ignore
-    /// while let Some(val) = iter() {
+    /// while let Some(val) = iter.next() {
+    ///     ..
+    /// }
+    /// ```
+    ///
+    /// Use instead:
+    /// ```ignore
+    /// for val in &mut iter {
     ///     ..
     /// }
     /// ```