Skip to content

Commit 5c0c5e3

Browse files
committed
bless
1 parent 2603a10 commit 5c0c5e3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/ui/needless_range_loop.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ error: the loop variable `i` is only used to index `vec2`
6161
LL | for i in 0..vec.len() {
6262
| ^^^^^^^^^^^^
6363
|
64+
= note: suggestion might skip expected iterations if `vec2.iter().count()` is less than `vec.len()`
6465
help: consider using an iterator
6566
|
6667
LL | for <item> in vec2.iter().take(vec.len()) {
@@ -72,6 +73,7 @@ error: the loop variable `i` is only used to index `vec`
7273
LL | for i in 5..vec.len() {
7374
| ^^^^^^^^^^^^
7475
|
76+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `5`
7577
help: consider using an iterator
7678
|
7779
LL | for <item> in vec.iter().skip(5) {
@@ -83,6 +85,7 @@ error: the loop variable `i` is only used to index `vec`
8385
LL | for i in 0..MAX_LEN {
8486
| ^^^^^^^^^^
8587
|
88+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `MAX_LEN`
8689
help: consider using an iterator
8790
|
8891
LL | for <item> in vec.iter().take(MAX_LEN) {
@@ -94,6 +97,7 @@ error: the loop variable `i` is only used to index `vec`
9497
LL | for i in 0..=MAX_LEN {
9598
| ^^^^^^^^^^^
9699
|
100+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `MAX_LEN + 1`
97101
help: consider using an iterator
98102
|
99103
LL | for <item> in vec.iter().take(MAX_LEN + 1) {
@@ -105,6 +109,7 @@ error: the loop variable `i` is only used to index `vec`
105109
LL | for i in 5..10 {
106110
| ^^^^^
107111
|
112+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `5` or `10`
108113
help: consider using an iterator
109114
|
110115
LL | for <item> in vec.iter().take(10).skip(5) {
@@ -116,6 +121,7 @@ error: the loop variable `i` is only used to index `vec`
116121
LL | for i in 5..=10 {
117122
| ^^^^^^
118123
|
124+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `5` or `10 + 1`
119125
help: consider using an iterator
120126
|
121127
LL | for <item> in vec.iter().take(10 + 1).skip(5) {
@@ -127,6 +133,7 @@ error: the loop variable `i` is used to index `vec`
127133
LL | for i in 5..vec.len() {
128134
| ^^^^^^^^^^^^
129135
|
136+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `5`
130137
help: consider using an iterator and enumerate()
131138
|
132139
LL | for (i, <item>) in vec.iter().enumerate().skip(5) {
@@ -138,6 +145,7 @@ error: the loop variable `i` is used to index `vec`
138145
LL | for i in 5..10 {
139146
| ^^^^^
140147
|
148+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `5` or `10`
141149
help: consider using an iterator and enumerate()
142150
|
143151
LL | for (i, <item>) in vec.iter().enumerate().take(10).skip(5) {

tests/ui/needless_range_loop2.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ error: the loop variable `i` is only used to index `ns`
44
LL | for i in 3..10 {
55
| ^^^^^
66
|
7+
= note: suggestion might skip expected iterations if `ns.iter().count()` is less than `3` or `10`
78
= note: `-D clippy::needless-range-loop` implied by `-D warnings`
89
= help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]`
910
help: consider using an iterator
@@ -39,6 +40,7 @@ error: the loop variable `i` is only used to index `vec`
3940
LL | for i in x..x + 4 {
4041
| ^^^^^^^^
4142
|
43+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `x` or `x + 4`
4244
help: consider using an iterator
4345
|
4446
LL | for <item> in vec.iter_mut().skip(x).take(4) {
@@ -50,6 +52,7 @@ error: the loop variable `i` is only used to index `vec`
5052
LL | for i in x..=x + 4 {
5153
| ^^^^^^^^^
5254
|
55+
= note: suggestion might skip expected iterations if `vec.iter().count()` is less than `x` or `x + 4 + 1`
5356
help: consider using an iterator
5457
|
5558
LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) {

0 commit comments

Comments
 (0)