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 might misunderstand something, but not all multiplication and division should saturate by default.
Implementing saturating multiplication manually is quite complex. Division is far easier (one only needs to consider the divide by zero case, but even then the sign needs to be applied), but still non-trivial.
What it does
Add lint similar to IMPLICIT_SATURATING_SUB and IMPLICIT_SATURATING_ADD, but for MUL and DIV.
Lint Name
IMPLICIT_SATURATING_MUL and IMPLICIT_SATURATING_DIV
Category
pedantic
Advantage
As mentioned at clippy::implicit_saturating_sub and clippy::implicit_saturating_add, the built-in function is more readable and may be faster.
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: