Closed
Description
What it does
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.