Skip to content

Regression tests for Rustup breakage tracking issue #3913 #3936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/ui/explicit_iter_loop_no_sugg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Tracking issue: #3913
#![deny(clippy::explicit_iter_loop)]

fn main() {
let vec = vec![1];
for _v in vec.iter() {} //~ ERROR change to `&vec`
}
14 changes: 14 additions & 0 deletions tests/ui/explicit_iter_loop_no_sugg.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/explicit_iter_loop_no_sugg.rs:6:15
|
LL | for _v in vec.iter() {} //~ ERROR change to `&vec`
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
|
note: lint level defined here
--> $DIR/explicit_iter_loop_no_sugg.rs:2:9
|
LL | #![deny(clippy::explicit_iter_loop)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

6 changes: 6 additions & 0 deletions tests/ui/into_iter_on_array_in_for_loop.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Tracking issue: #3913
#![deny(clippy::into_iter_on_array)]

fn main() {
for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
}
14 changes: 14 additions & 0 deletions tests/ui/into_iter_on_array_in_for_loop.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:5:24
|
LL | for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
|
note: lint level defined here
--> $DIR/into_iter_on_ref.rs:2:9
|
LL | #![deny(clippy::into_iter_on_array)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error