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
Suggest replacing the expression x == Some(true) with x.unwrap_or(false). To me the second form better expresses what's going on: use the value in x otherwise default to false.
This is similar to the bool_comparison lint but I guess it could be more controversial. I'm OK if it's pedantic or restriction depending on what other people think.
The text was updated successfully, but these errors were encountered:
the latter is longer, uses a method readers may not be very familiar with (in comparison, every programmer should immediately know what == means), only works with booleans (whereas == Some(x) works on any PartialEq type) and may have worse performance on debug builds (function call instead of a simple bitwise comparison).
if this is implemented, i think it should definitely be restriction.
Suggest replacing the expression
x == Some(true)
withx.unwrap_or(false)
. To me the second form better expresses what's going on: use the value inx
otherwise default tofalse
.This is similar to the
bool_comparison
lint but I guess it could be more controversial. I'm OK if it'spedantic
orrestriction
depending on what other people think.The text was updated successfully, but these errors were encountered: