]> git.lizzy.rs Git - rust.git/blob - src/docs/cast_possible_truncation.txt
Auto merge of #8952 - rust-lang:explain, r=xFredNet
[rust.git] / src / docs / cast_possible_truncation.txt
1 ### What it does
2 Checks for casts between numerical types that may
3 truncate large values. This is expected behavior, so the cast is `Allow` by
4 default.
5
6 ### Why is this bad?
7 In some problem domains, it is good practice to avoid
8 truncation. This lint can be activated to help assess where additional
9 checks could be beneficial.
10
11 ### Example
12 ```
13 fn as_u8(x: u64) -> u8 {
14     x as u8
15 }
16 ```