static ENUM_INTRINSICS_NON_ENUMS: &LintExpand description
The enum_intrinsics_non_enums lint detects calls to
intrinsic functions that require an enum (core::mem::discriminant,
core::mem::variant_count), but are called with a non-enum type.
§Example
ⓘ
#![deny(enum_intrinsics_non_enums)]
core::mem::discriminant::<i32>(&123);{{produces}}
§Explanation
In order to accept any enum, the mem::discriminant and
mem::variant_count functions are generic over a type T.
This makes it technically possible for T to be a non-enum,
in which case the return value is unspecified.
This lint prevents such incorrect usage of these functions.