Closed
Description
I'm not saying this is a lint I'd enable—but I just came across the fact that it currently generates outpt like this:
error: called `map(f).unwrap_or(a)` on an Option value. This can be done more directly by calling `map_or(a, f)` instead
--> $DIR/methods.rs:103:13
|
103 | let _ = opt.map(|x| x + 1)
| _____________^
104 | |
105 | | .unwrap_or(0); // should lint even though this call is on a separate line
| |____________________________^
|
= note: `-D option-map-unwrap-or` implied by `-D warnings`
= note: replace `map(|x| x + 1).unwrap_or(0)` with `map_or(0, |x| x + 1)`
It looks like the suggestion is pretty stable, right? Let's turn it into an actual rustfix-able suggestion, then!