rust/tests/ui/map_with_unused_argument_over_ranges.stderr

224 lines
7.5 KiB
Plaintext
Raw Normal View History

error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:25:5
|
LL | (0..10).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::map-with-unused-argument-over-ranges` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::map_with_unused_argument_over_ranges)]`
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..10).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(10);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:26:5
|
LL | (0..10).map(|_foo| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..10).map(|_foo| do_something());
LL + std::iter::repeat_with(|| do_something()).take(10);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:27:5
|
LL | (0..=10).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..=10).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(11);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:28:5
|
LL | (3..10).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (3..10).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(7);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:29:5
|
LL | (3..=10).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (3..=10).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(8);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:30:5
|
LL | (0..10).map(|_| 3);
| ^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_n`
|
LL | std::iter::repeat_n(3, 10);
| ~~~~~~~~~~~~~~~~~~~ ~~~~~
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:31:5
|
LL | / (0..10).map(|_| {
LL | | let x = 3;
LL | | x + 2
LL | | });
| |______^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL ~ std::iter::repeat_with(|| {
LL | let x = 3;
LL | x + 2
LL ~ }).take(10);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:35:5
|
LL | (0..10).map(|_| do_something()).collect::<Vec<_>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..10).map(|_| do_something()).collect::<Vec<_>>();
LL + std::iter::repeat_with(|| do_something()).take(10).collect::<Vec<_>>();
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:37:5
|
LL | (0..upper).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..upper).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(upper);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:39:5
|
LL | (0..upper_fn()).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..upper_fn()).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(upper_fn());
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:40:5
|
LL | (0..=upper_fn()).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..=upper_fn()).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(upper_fn() + 1);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:41:5
|
LL | (2..upper_fn()).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (2..upper_fn()).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(upper_fn() - 2);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:42:5
|
LL | (2..=upper_fn()).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (2..=upper_fn()).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(upper_fn() - 1);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:44:5
|
LL | (9..3).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (9..3).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(0);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:45:5
|
LL | (9..=9).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (9..=9).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(1);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:46:5
|
LL | (1..=1 << 4).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (1..=1 << 4).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take((1 << 4) - 0);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:67:5
|
LL | (0..10).map(|_| do_something());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat_with` and `take`
|
LL - (0..10).map(|_| do_something());
LL + std::iter::repeat_with(|| do_something()).take(10);
|
error: map of a closure that does not depend on its parameter over a range
--> tests/ui/map_with_unused_argument_over_ranges.rs:72:5
|
LL | (0..10).map(|_| 3);
| ^^^^^^^^^^^^^^^^^^
|
help: remove the explicit range and use `repeat` and `take`
|
LL | std::iter::repeat(3).take(10);
| ~~~~~~~~~~~~~~~~~ ~ +++++++++
error: aborting due to 18 previous errors