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
Others might disagree, but I feel this is very specific (-n as … following is_negative() or < 0 or <= 0). Do you have evidence of this happening in the wild? I couldn't find code with this pattern.
Or maybe we could include it in a more general lint manual_abs which would also detect the same thing without as ….
What it does
Replace
-{signed} as {unsigned}
with{signed}.unsigned_abs()
Advantage
Clear and concise meaning & order of operations.
No panics or overflow (potentially).
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: