-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix false positive with cast_sign_loss lint #4883
Fix false positive with cast_sign_loss lint #4883
Conversation
`cast_sign_loss` lint incorrectly suggests that the result of `checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot be casted to an unsigned integer without loss.
Does this also work with type widening, such as Other than that question, looks good to me. |
@jhpratt It allows widening as well. Should I add test cases for that as well? |
It certainly wouldn't hurt! |
Should I add test cases for all the sized types or just one for u8 -> u16 widening? |
@flip1995 Please review when you have some time. |
Sorry, was absent for the past few days. Can be merged as is, awesome! 🎉 @bors r+ |
📌 Commit c0fb74b has been approved by |
…lse-positive, r=flip1995 Fix false positive with cast_sign_loss lint `cast_sign_loss` lint incorrectly suggests that the result of `checked_abs`, `rem_euclid` and `checked_rem_euclid` cannot be casted to an unsigned integer without loss. Fixes #4818 #4764 #4743 changelog: Fix false positives in `cast_sign_loss` lint
☀️ Test successful - checks-travis, status-appveyor |
@flip1995 No worries. Thanks! |
cast_sign_loss
lint incorrectly suggests that the result ofchecked_abs
,rem_euclid
andchecked_rem_euclid
cannot be casted to an unsigned integer without loss.Fixes #4818 #4764 #4743
changelog: Fix false positives in
cast_sign_loss
lint