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
Emits a warning on empty blocks (no statements nor an expression).
Advantage
This is always unnecessary (afaik), and even on the off chance it mutates something else (like potentially in the condition for an if), the if can be entirely removed, leaving just the condition.
Drawbacks
None
Example
ifi_mutate_a_variable(&mut owo){}let _x = {};
Could be written as:
i_mutate_a_variable(&mut owo);// <removed>
The text was updated successfully, but these errors were encountered:
I feel like this could be turned into more specific lints, as an example of one, needless_if similar to needless_else, but for if <expr> {} instead (suggesting to omit the if altogether, and only have <expr>).
It's worth noting though that many cases will likely require an empty block, so a catchall can't really be used (except for maybe a block on its own, not part of an if statement or anything)
What it does
Emits a warning on empty blocks (no statements nor an expression).
Advantage
This is always unnecessary (afaik), and even on the off chance it mutates something else (like potentially in the condition for an
if
), theif
can be entirely removed, leaving just the condition.Drawbacks
None
Example
Could be written as:
The text was updated successfully, but these errors were encountered: