Files
rust/tests/ui/lint/issue-109152.stderr
Esteban Küber f0845adb0c Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
2025-02-10 20:21:39 +00:00

25 lines
1.0 KiB
Plaintext

error: `Iterator::map` call that discard the iterator's values
--> $DIR/issue-109152.rs:5:21
|
LL | vec![42].iter().map(drop);
| ^^^^----^
| | |
| | this function returns `()`, which is likely not what you wanted
| | 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/issue-109152.rs:1:9
|
LL | #![deny(map_unit_fn)]
| ^^^^^^^^^^^
help: you might have meant to use `Iterator::for_each`
|
LL - vec![42].iter().map(drop);
LL + vec![42].iter().for_each(drop);
|
error: aborting due to 1 previous error