You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/rustc_tests.rs
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -2087,19 +2087,19 @@ fn main() {
2087
2087
error: `Iterator::map` call that discard the iterator's values
2088
2088
--> $DIR/lint_map_unit_fn.rs:11:18
2089
2089
|
2090
-
LL | x.iter_mut().map(|items| {
2091
-
| ^ -------
2092
-
| | |
2093
-
| __________________|___this function returns `()`, which is likely not what you wanted
2094
-
| |__________________|
2095
-
| ||
2096
-
LL | || //~^ ERROR `Iterator::map` call that discard the iterator's values
2097
-
LL | || items.sort();
2098
-
LL | || });
2099
-
| || -^ 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
2100
-
| ||_____||
2101
-
| |_____|
2102
-
| called `Iterator::map` with callable that returns `()`
2090
+
LL | x.iter_mut().map(|items| {
2091
+
| ^ -------
2092
+
| | |
2093
+
| ____________________|___this function returns `()`, which is likely not what you wanted
2094
+
| | __________________|
2095
+
| ||
2096
+
LL | || //~^ ERROR `Iterator::map` call that discard the iterator's values
2097
+
LL | || items.sort();
2098
+
LL | || });
2099
+
| || -^ 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
2100
+
| ||_____||
2101
+
| |_______|
2102
+
| called `Iterator::map` with callable that returns `()`
2103
2103
|
2104
2104
= 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
2105
2105
help: you might have meant to use `Iterator::for_each`
0 commit comments