summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/invalid_upcast_comparisons.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/invalid_upcast_comparisons.txt')
-rw-r--r--src/tools/clippy/src/docs/invalid_upcast_comparisons.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/invalid_upcast_comparisons.txt b/src/tools/clippy/src/docs/invalid_upcast_comparisons.txt
new file mode 100644
index 000000000..77cb03308
--- /dev/null
+++ b/src/tools/clippy/src/docs/invalid_upcast_comparisons.txt
@@ -0,0 +1,18 @@
+### What it does
+Checks for comparisons where the relation is always either
+true or false, but where one side has been upcast so that the comparison is
+necessary. Only integer types are checked.
+
+### Why is this bad?
+An expression like `let x : u8 = ...; (x as u32) > 300`
+will mistakenly imply that it is possible for `x` to be outside the range of
+`u8`.
+
+### Known problems
+https://github.com/rust-lang/rust-clippy/issues/886
+
+### Example
+```
+let x: u8 = 1;
+(x as u32) > 300;
+``` \ No newline at end of file