Code
fn main() {
b"abc".iter().for_each(|x| dbg!(x))
}
Current output
error[E0308]: mismatched types
--> src/main.rs:2:32
|
2 | b"abc".iter().for_each(|x| dbg!(x))
| -^^^^^^^ expected `()`, found `&u8`
| |
| help: try adding a return type: `-> &u8`
|
Desired output
error[E0308]: mismatched types
--> src/main.rs:2:32
|
2 | b"abc".iter().for_each(|x| dbg!(x))
| -^^^^^^^ expected `()`, found `&u8`
| |
| help: try ignoring this value: `_ = dbg!(x)`
Rationale and extra context
closures have their return type inferred if not specified, so adding a return type to a closure will never fix a type mismatch error.
Other cases
No response
Rust Version
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
closures have their return type inferred if not specified, so adding a return type to a closure will never fix a type mismatch error.
Other cases
No response
Rust Version
Anything else?
No response