diff options
Diffstat (limited to 'src/docs/checked_conversions.txt')
| -rw-r--r-- | src/docs/checked_conversions.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/docs/checked_conversions.txt b/src/docs/checked_conversions.txt new file mode 100644 index 00000000000..536b01294ee --- /dev/null +++ b/src/docs/checked_conversions.txt @@ -0,0 +1,15 @@ +### What it does +Checks for explicit bounds checking when casting. + +### Why is this bad? +Reduces the readability of statements & is error prone. + +### Example +``` +foo <= i32::MAX as u32; +``` + +Use instead: +``` +i32::try_from(foo).is_ok(); +``` \ No newline at end of file |
