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
I actually prefer reading this interface like this, because I can kind of simultaneously see both branches (the "total" effect of each branch) and I kind of know beforehand that such value (_previously_unset) won't be used anywhere else, for anything else.
The "literal" translation for the if-else case would be:
But in this case, to see the "total" effect of previously_unset @ true, I'd have to look past the if statement and see where the variable would still be used (in which, in this case, would be nowhere.. since the scope ended).
Both cases have 6 lines, and the first one is slightly more verbose. But I actually am more comfortable at reasoning about the first case - it feels familiar, as if the function returned an enum of two cases..
so... this is a suggestion and perhaps you could agree with!
Thanks in advance,
The text was updated successfully, but these errors were encountered:
Hello, I have a suggestion for the
match_bool
linthttps://rust-lang.github.io/rust-clippy/master/index.html#match_bool
I'm not sure if this is idiomatic, buy I often attach (
@
) matched values into variables, eg.:I actually prefer reading this interface like this, because I can kind of simultaneously see both branches (the "total" effect of each branch) and I kind of know beforehand that such value (
_previously_unset
) won't be used anywhere else, for anything else.The "literal" translation for the if-else case would be:
But in this case, to see the "total" effect of
previously_unset @ true
, I'd have to look past theif
statement and see where the variable would still be used (in which, in this case, would be nowhere.. since the scope ended).Both cases have 6 lines, and the first one is slightly more verbose. But I actually am more comfortable at reasoning about the first case - it feels familiar, as if the function returned an enum of two cases..
so... this is a suggestion and perhaps you could agree with!
Thanks in advance,
The text was updated successfully, but these errors were encountered: