You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What it does: Checks for usage of _.map(_).unwrap_or(_).
Why is this bad: Readability, this can be written more concisely as _.map_or(_, _).
I think having two method calls with one parameter makes the intent clearer than using one with two parameters (one method call per line does one thing). This may also keep the diff-noise down a bit.
The same goes for option_map_unwrap_or_else.
The text was updated successfully, but these errors were encountered:
Worse, the argument order is confusing; personally, I'd lint against using this function. When I see map_or_else, I expect the first function to be the map function and the second to be the "else" function but it's actually backwards.
One of the lints I ignore most often is option_map_unwrap_or.
The docs say:
I think having two method calls with one parameter makes the intent clearer than using one with two parameters (one method call per line does one thing). This may also keep the diff-noise down a bit.
The same goes for option_map_unwrap_or_else.
The text was updated successfully, but these errors were encountered: