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 casts of a function pointer to a numeric type not enough to store address.
Why is this bad
Casting a function pointer to not eligable type could truncate the address value.
"Eligable" looks like it was intended to be "eligible", but I find "eligible type" vs "not eligible type" not a clear way to identify types that are wide enough to hold the address vs not wide enough.
I think this lint would be sufficiently justified by saying:
- Checks for casts of a function pointer to a numeric type not enough to store address.+ Checks for casts of a function pointer to a numeric type not wide enough to store address.
- Casting a function pointer to not eligable type could truncate the address value.+ Such a cast discards some bits of the function's address. If this is intended, it would+ be more clearly expressed by casting to usize first, then casting the usize to the+ intended type (with a comment) to perform the truncation.
Mentioning @VKlayd who worked on this lint in #2814.
The text was updated successfully, but these errors were encountered:
https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#fn_to_numeric_cast_with_truncation
"Eligable" looks like it was intended to be "eligible", but I find "eligible type" vs "not eligible type" not a clear way to identify types that are wide enough to hold the address vs not wide enough.
I think this lint would be sufficiently justified by saying:
Mentioning @VKlayd who worked on this lint in #2814.
The text was updated successfully, but these errors were encountered: