about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-10 20:26:03 +0000
committerbors <bors@rust-lang.org>2024-07-10 20:26:03 +0000
commitef3cfaa4f215a96a69ea81ee6fce8e58bdc51115 (patch)
treef463291c06f4a77512f9cdd79b1f8d8a2347c363
parent8d3b1f9e30698067a65f74a668800e1a0628303a (diff)
parenta987c308cdcfc000d6980487f05222c0799c09e9 (diff)
downloadrust-ef3cfaa4f215a96a69ea81ee6fce8e58bdc51115.tar.gz
rust-ef3cfaa4f215a96a69ea81ee6fce8e58bdc51115.zip
Auto merge of #13081 - GuillaumeGomez:fix-iter_next_loop.rs, r=y21
Fix `iter_next_loop.rs` ui test

I'm uncovering bugs while working on https://github.com/rust-lang/rust-clippy/pull/11421. ^^'

changelog: none
-rw-r--r--tests/ui/iter_next_loop.rs2
-rw-r--r--tests/ui/iter_next_loop.stderr10
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/ui/iter_next_loop.rs b/tests/ui/iter_next_loop.rs
index 548b799de44..d425f4da0e8 100644
--- a/tests/ui/iter_next_loop.rs
+++ b/tests/ui/iter_next_loop.rs
@@ -3,7 +3,7 @@
 
 fn main() {
     let x = [1, 2, 3, 4];
-    for _ in vec.iter().next() {}
+    for _ in x.iter().next() {}
 
     struct Unrelated(&'static [u8]);
     impl Unrelated {
diff --git a/tests/ui/iter_next_loop.stderr b/tests/ui/iter_next_loop.stderr
index 85c23f4e709..acc55031c3b 100644
--- a/tests/ui/iter_next_loop.stderr
+++ b/tests/ui/iter_next_loop.stderr
@@ -1,9 +1,11 @@
-error[E0423]: expected value, found macro `vec`
+error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
   --> tests/ui/iter_next_loop.rs:6:14
    |
-LL |     for _ in vec.iter().next() {}
-   |              ^^^ not a value
+LL |     for _ in x.iter().next() {}
+   |              ^^^^^^^^^^^^^^^
+   |
+   = note: `-D clippy::iter-next-loop` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::iter_next_loop)]`
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0423`.