When rendering subdiagnostics with long labels or messages that would render beyond the terminal width, split the label or message on a best effort basis so that the text is rendered with newlines, keeping the text left-aligned and within the terminal width.
error: `Iterator::map` call that discard the iterator's values
--> $DIR/lint_map_unit_fn.rs:11:18
|
11 | x.iter_mut().map(|items| {
| ^ -------
| | |
| ____________________|___this function returns `()`, which is likely not what you wanted
| | __________________|
| | |
12 | | | //~^ ERROR `Iterator::map` call that discard the iterator's values
13 | | | items.sort();
14 | | | });
| | | -^ 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`
|
11 - x.iter_mut().map(|items| {
11 + x.iter_mut().for_each(|items| {
|
After:
error: `Iterator::map` call that discard the iterator's values
--> $DIR/lint_map_unit_fn.rs:11:18
|
11 | x.iter_mut().map(|items| {
| ^ -------
| | |
| ____________________|___this function returns `()`, which is likely not
| | | what you wanted
| | __________________|
| | |
12 | | | //~^ ERROR `Iterator::map` call that discard the iterator's values
13 | | | items.sort();
14 | | | });
| | | -^
| | |_____||
| | |_____||
| | |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`
|
11 - x.iter_mut().map(|items| {
11 + x.iter_mut().for_each(|items| {
|
When rendering subdiagnostics with long labels or messages that would render beyond the terminal width, split the label or message on a best effort basis so that the text is rendered with newlines, keeping the text left-aligned and within the terminal width.
After: