Static rustc_lint::ptr_nulls::USELESS_PTR_NULL_CHECKS
source · static USELESS_PTR_NULL_CHECKS: &Lint
Expand description
The useless_ptr_null_checks
lint checks for useless null checks against pointers
obtained from non-null types.
Example
let fn_ptr: fn() = /* somehow obtained nullable function pointer */
if (fn_ptr as *const ()).is_null() { /* ... */ }
{{produces}}
Explanation
Function pointers and references are assumed to be non-null, checking them for null will always return false.