fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.8 KiB66 linesraw
1error: `Iterator::map` call that discard the iterator's values
2  --> $DIR/lint_map_unit_fn.rs:9:18
3   |
4LL | fn foo(items: &mut Vec<u8>) {
5   | --------------------------- this function returns `()`, which is likely not what you wanted
6...
7LL |     x.iter_mut().map(foo);
8   |                  ^^^^---^
9   |                  |   |
10   |                  |   called `Iterator::map` with callable that returns `()`
11   |                  after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
12   |
13   = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated
14note: the lint level is defined here
15  --> $DIR/lint_map_unit_fn.rs:1:9
16   |
17LL | #![deny(map_unit_fn)]
18   |         ^^^^^^^^^^^
19help: you might have meant to use `Iterator::for_each`
20   |
21LL |     x.iter_mut().for_each(foo);
22   |                  ~~~~~~~~
23
24error: `Iterator::map` call that discard the iterator's values
25  --> $DIR/lint_map_unit_fn.rs:11:18
26   |
27LL |         x.iter_mut().map(|items| {
28   |                      ^   -------
29   |                      |   |
30   |  ____________________|___this function returns `()`, which is likely not what you wanted
31   | |  __________________|
32   | | |
33LL | | |
34LL | | |         items.sort();
35LL | | |     });
36   | | |     -^ after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
37   | | |_____||
38   | |_______|
39   |         called `Iterator::map` with callable that returns `()`
40   |
41   = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated
42help: you might have meant to use `Iterator::for_each`
43   |
44LL |     x.iter_mut().for_each(|items| {
45   |                  ~~~~~~~~
46
47error: `Iterator::map` call that discard the iterator's values
48  --> $DIR/lint_map_unit_fn.rs:18:18
49   |
50LL |     let f = |items: &mut Vec<u8>| {
51   |             --------------------- this function returns `()`, which is likely not what you wanted
52...
53LL |     x.iter_mut().map(f);
54   |                  ^^^^-^
55   |                  |   |
56   |                  |   called `Iterator::map` with callable that returns `()`
57   |                  after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
58   |
59   = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated
60help: you might have meant to use `Iterator::for_each`
61   |
62LL |     x.iter_mut().for_each(f);
63   |                  ~~~~~~~~
64
65error: aborting due to 3 previous errors
66