static INCORRECT_FN_NULL_CHECKS: &Lint
Expand description

The incorrect_fn_null_checks lint checks for expression that checks if a function pointer is null.

Example

let fn_ptr: fn() = /* somehow obtained nullable function pointer */

if (fn_ptr as *const ()).is_null() { /* ... */ }

{{produces}}

Explanation

Function pointers are assumed to be non-null, checking them for null will always return false.