-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Clippy misses integer arithmetic error for a specific type #8968
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
Comments
It appears to trigger the lint for https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5ae8ae28263bb35ccc1987355557aa80 Is there some other context needed? |
Currently I can't reproduce the error in the rust playground, but I try to describe it with the specific code. Here is the code, where I would expect a clippy integer arithmetic error. The This BalanceOf type alias references to the following trait type. type Balance: Balance + MaybeSerializeDeserialize + Debug + MaxEncodedLen; Where pub trait Balance:
AtLeast32BitUnsigned + FullCodec + Copy + Default + Debug + scale_info::TypeInfo
{
}
impl<T: AtLeast32BitUnsigned + FullCodec + Copy + Default + Debug + scale_info::TypeInfo> Balance
for T
{
} Reference to the The constant |
|
Thank you for your answer. What a pitty! |
There should be a lint for using any arithmetic operators soonish. Somebody was working on it. |
With #9130 merged, this issue can be closed. |
Summary
I expected an clippy error when using a specific type, which resolves to be an integer (
u128
).Reproducer
I tried this code:
When running with
-Dclippy::integer_arithmetic
I expected to see this happen:
error: integer arithmetic detected
Instead, this happened:
No error.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: