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
Checks for manual reimplementations of the .rem_euclid() function.
Lint Name
No response
Category
complexity
Advantage
When people search for how to calculate positive modulos of integers, top Google results and Stack Overflow tend to feature the ((a % n) + n) % n method as a solution to the problem. Rust has a function to calculate this, .rem_euclid(). It would be great to suggest people using this function instead (only in cases where n can be proven as positive).
Uh oh!
There was an error while loading. Please reload this page.
What it does
Checks for manual reimplementations of the
.rem_euclid()
function.Lint Name
No response
Category
complexity
Advantage
When people search for how to calculate positive modulos of integers, top Google results and Stack Overflow tend to feature the
((a % n) + n) % n
method as a solution to the problem. Rust has a function to calculate this,.rem_euclid()
. It would be great to suggest people using this function instead (only in cases wheren
can be proven as positive).Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: