Make find_map
lint be more conservative
#4193
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
The find_map lint will trigger if you do a
filter
followed by amap
but its not always preferable.In the case of the first lint at least, you'll run into lifetime issues if you try to replace lines 131 and 132 with a find_map call.
And even if it didn't run into the borrow error I personally feel like the find_map version is less concise than the filter -> map version.
If the Item type of the iterator was already a
Try
type then I can see it being easy enough to write a concise find_map impl, but with the boolean as the only starting point for the closure outputtingSome
orNone
I don't think it works as nicely as filter and map.The text was updated successfully, but these errors were encountered: