summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/lint_map_unit_fn.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/lint/lint_map_unit_fn.stderr
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/lint_map_unit_fn.stderr')
-rw-r--r--tests/ui/lint/lint_map_unit_fn.stderr66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/ui/lint/lint_map_unit_fn.stderr b/tests/ui/lint/lint_map_unit_fn.stderr
new file mode 100644
index 000000000..fbf689c54
--- /dev/null
+++ b/tests/ui/lint/lint_map_unit_fn.stderr
@@ -0,0 +1,66 @@
+error: `Iterator::map` call that discard the iterator's values
+ --> $DIR/lint_map_unit_fn.rs:9:18
+ |
+LL | fn foo(items: &mut Vec<u8>) {
+ | --------------------------- this function returns `()`, which is likely not what you wanted
+...
+LL | x.iter_mut().map(foo);
+ | ^^^^---^
+ | | |
+ | | called `Iterator::map` with callable that returns `()`
+ | 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
+ |
+ = 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
+note: the lint level is defined here
+ --> $DIR/lint_map_unit_fn.rs:1:9
+ |
+LL | #![deny(map_unit_fn)]
+ | ^^^^^^^^^^^
+help: you might have meant to use `Iterator::for_each`
+ |
+LL | x.iter_mut().for_each(foo);
+ | ~~~~~~~~
+
+error: `Iterator::map` call that discard the iterator's values
+ --> $DIR/lint_map_unit_fn.rs:11:18
+ |
+LL | x.iter_mut().map(|items| {
+ | ^ -------
+ | | |
+ | ____________________|___this function returns `()`, which is likely not what you wanted
+ | | __________________|
+ | | |
+LL | | |
+LL | | | items.sort();
+LL | | | });
+ | | | -^ 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
+ | | |_____||
+ | |_______|
+ | called `Iterator::map` with callable that returns `()`
+ |
+ = 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
+help: you might have meant to use `Iterator::for_each`
+ |
+LL | x.iter_mut().for_each(|items| {
+ | ~~~~~~~~
+
+error: `Iterator::map` call that discard the iterator's values
+ --> $DIR/lint_map_unit_fn.rs:18:18
+ |
+LL | let f = |items: &mut Vec<u8>| {
+ | --------------------- this function returns `()`, which is likely not what you wanted
+...
+LL | x.iter_mut().map(f);
+ | ^^^^-^
+ | | |
+ | | called `Iterator::map` with callable that returns `()`
+ | 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
+ |
+ = 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
+help: you might have meant to use `Iterator::for_each`
+ |
+LL | x.iter_mut().for_each(f);
+ | ~~~~~~~~
+
+error: aborting due to 3 previous errors
+