summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/cast_enum_truncation.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/cast_enum_truncation.txt')
-rw-r--r--src/tools/clippy/src/docs/cast_enum_truncation.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/cast_enum_truncation.txt b/src/tools/clippy/src/docs/cast_enum_truncation.txt
new file mode 100644
index 000000000..abe32a829
--- /dev/null
+++ b/src/tools/clippy/src/docs/cast_enum_truncation.txt
@@ -0,0 +1,12 @@
+### What it does
+Checks for casts from an enum type to an integral type which 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;
+``` \ No newline at end of file