Skip to content

Commit 7adf24e

Browse files
committed
Improve docs of fn_to_numeric_cast
Closes #2980
1 parent f422721 commit 7adf24e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clippy_lints/src/types.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,12 @@ declare_clippy_lint! {
722722
/// **What it does:** Checks for casts of function pointers to something other than usize
723723
///
724724
/// **Why is this bad?**
725-
/// Depending on the system architechture, casting a function pointer to something other than
726-
/// `usize` will result in incorrect pointer addresses.
727-
/// `usize` will always be able to store the function pointer on the given architechture.
725+
/// Casting a function pointer to anything other than usize/isize is not portable across
726+
/// architectures, because you end up losing bits if the target type is too small or end up with a
727+
/// bunch of extra bits that waste space and add more instructions to the final binary than
728+
/// strictly necessary for the problem
729+
///
730+
/// Casting to isize also doesn't make sense since there are no signed addresses.
728731
///
729732
/// **Example**
730733
///

0 commit comments

Comments
 (0)