Detect .map_or(false, f) in manual_is_variant_and lint#13509
Detect .map_or(false, f) in manual_is_variant_and lint#13509samueltardieu wants to merge 2 commits intorust-lang:masterfrom
.map_or(false, f) in manual_is_variant_and lint#13509Conversation
|
r? @Manishearth rustbot has assigned @Manishearth. Use |
|
FWIW, this is also being implemented in #11796, though as a new lint and not part of |
Oh. So what do we do? Although I think this check rather belongs to |
|
Moreover, @Jacherr PR could be retargeted to catch instances of |
|
The existing PR is pretty far through the review process and as far as I know just needs a few more changes before being ready for merging. I just need time to get round to it! As is, I’m not sure there’s much benefit complicating the situation even further with that PR because it’s been open for almost a year now (oops..) As for these improvements, they can probably be retroactively applied after the fact (either by myself or you). |
|
Fine with me, I'll keep this PR in my own version for the time being so that I can benefit from the lint (I detected some usages of |
|
On vacation for a week. Feel free to retarget review with |
.map_or(false, f)on aOptionor aResultwas not detected bymanual_is_variant_and.This change is small (first commit), but induces a lot of (rightful) fixes (second commit) in Clippy sources.
changelog: [
manual_is_variant_and]: add detection of.map_or(false, f)pattern