RS.CLIPPY.CONFUSING_METHOD_TO_NUMERIC_CAST
Casting a primitive method pointer to any integer type
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: confusing_method_to_numeric_cast. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for casts of a primitive method pointer like max/min to any integer type.
Why restrict this?
Casting a function pointer to an integer can have surprising results and can occur accidentally if parentheses are omitted from a function call. If you aren't doing anything low-level with function pointers then you can opt out of casting functions to integers in order to avoid mistakes. Alternatively, you can use this lint to audit all uses of function pointer casts in your code.
Example
let _ = u16::max as usize;
Use instead:
let _ = u16::MAX as usize;