rust/tests/ui/reversed_empty_ranges_fixable.stderr

54 lines
1.9 KiB
Plaintext
Raw Normal View History

2020-05-10 22:52:33 +00:00
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:11:5
2020-05-10 22:52:33 +00:00
|
LL | (42..=21).for_each(|x| println!("{}", x));
| ^^^^^^^^^
|
= note: `-D clippy::reversed-empty-ranges` implied by `-D warnings`
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | (21..=42).rev().for_each(|x| println!("{}", x));
| ^^^^^^^^^^^^^^^
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:12:13
2020-05-10 22:52:33 +00:00
|
LL | let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
| ^^^^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | let _ = (21..ANSWER).rev().filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:14:14
2020-05-10 22:52:33 +00:00
|
LL | for _ in -21..=-42 {}
| ^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for _ in (-42..=-21).rev() {}
| ^^^^^^^^^^^^^^^^^
error: this range is empty so it will yield no values
--> $DIR/reversed_empty_ranges_fixable.rs:15:14
2020-05-10 22:52:33 +00:00
|
LL | for _ in 42u32..21u32 {}
| ^^^^^^^^^^^^
|
help: consider using the following if you are attempting to iterate over this range in reverse
|
LL | for _ in (21u32..42u32).rev() {}
| ^^^^^^^^^^^^^^^^^^^^
error: this range is empty and using it to index a slice will always yield an empty slice
--> $DIR/reversed_empty_ranges_fixable.rs:17:18
|
LL | let _ = &arr[3..3];
| ----^^^^- help: if you want an empty slice, use: `[] as &[i32]`
error: aborting due to 5 previous errors
2020-05-10 22:52:33 +00:00