RS.CLIPPY.CAST_ENUM_TRUNCATION
Casts from an enum type to an integral type that will truncate the value
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: cast_enum_truncation. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for casts from an enum type to an integral type that will definitely truncate the value.
Why is this bad?
The resulting integral value will not match the value of the variant it came from.
Example
enum E { X = 256 };
let _ = E::X as u8;