Skip to content

Commit

Permalink
Fix test comment for while_let_on_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed May 13, 2021
1 parent 4713e25 commit cd0db8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
6 changes: 2 additions & 4 deletions tests/ui/while_let_on_iterator.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ fn issue1121() {
}

fn issue2965() {
// This should not cause an ICE and suggest:
//
// for _ in values.iter() {}
//
// This should not cause an ICE

use std::collections::HashSet;
let mut values = HashSet::new();
values.insert(1);
Expand Down
6 changes: 2 additions & 4 deletions tests/ui/while_let_on_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ fn issue1121() {
}

fn issue2965() {
// This should not cause an ICE and suggest:
//
// for _ in values.iter() {}
//
// This should not cause an ICE

use std::collections::HashSet;
let mut values = HashSet::new();
values.insert(1);
Expand Down
22 changes: 11 additions & 11 deletions tests/ui/while_let_on_iterator.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -43,69 +43,69 @@ LL | while let Some(_) = y.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in y`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:193:9
--> $DIR/while_let_on_iterator.rs:191:9
|
LL | while let Some(m) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in &mut it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:204:5
--> $DIR/while_let_on_iterator.rs:202:5
|
LL | while let Some(n) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:206:9
--> $DIR/while_let_on_iterator.rs:204:9
|
LL | while let Some(m) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:215:9
--> $DIR/while_let_on_iterator.rs:213:9
|
LL | while let Some(m) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:224:9
--> $DIR/while_let_on_iterator.rs:222:9
|
LL | while let Some(m) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in &mut it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:241:9
--> $DIR/while_let_on_iterator.rs:239:9
|
LL | while let Some(m) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for m in &mut it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:256:13
--> $DIR/while_let_on_iterator.rs:254:13
|
LL | while let Some(i) = self.0.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in &mut self.0`

error: manual `!RangeInclusive::contains` implementation
--> $DIR/while_let_on_iterator.rs:257:20
--> $DIR/while_let_on_iterator.rs:255:20
|
LL | if i < 3 || i > 7 {
| ^^^^^^^^^^^^^^ help: use: `!(3..=7).contains(&i)`
|
= note: `-D clippy::manual-range-contains` implied by `-D warnings`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:288:13
--> $DIR/while_let_on_iterator.rs:286:13
|
LL | while let Some(i) = self.0.0.0.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for i in &mut self.0.0.0`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:317:5
--> $DIR/while_let_on_iterator.rs:315:5
|
LL | while let Some(n) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for n in &mut it`

error: this loop could be written as a `for` loop
--> $DIR/while_let_on_iterator.rs:327:5
--> $DIR/while_let_on_iterator.rs:325:5
|
LL | while let Some(..) = it.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in it`
Expand Down

0 comments on commit cd0db8a

Please sign in to comment.