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
In this code (playground) compiler with warn is_prime(x) || continue; with unused logical operation that must be used. However, if we add a let temp = is_prime(x) || continue; the temp would be always true, if is_prime(x) is true it will be short-circuited with true, and otherwise it would be diverge and we will never see anything other than true. It is like warning unused_must_use on Result<(), !> which it is always Ok(()) and using it is pointless. So is it good to turn off this warning? Or current behavior is intended?
I see that this isn't a good code, but unused_must_use isn't a good warning for preventing that. Another warning (probably in clippy) can say that please don't abuse short circuit operators.
The text was updated successfully, but these errors were encountered:
In this code (playground) compiler with warn
is_prime(x) || continue;
withunused logical operation that must be used
. However, if we add alet temp = is_prime(x) || continue;
thetemp
would be always true, ifis_prime(x)
is true it will be short-circuited with true, and otherwise it would be diverge and we will never see anything other than true. It is like warning unused_must_use onResult<(), !>
which it is alwaysOk(())
and using it is pointless. So is it good to turn off this warning? Or current behavior is intended?I see that this isn't a good code, but unused_must_use isn't a good warning for preventing that. Another warning (probably in clippy) can say that
please don't abuse short circuit operators
.The text was updated successfully, but these errors were encountered: