]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | Checks for casts from a signed to an unsigned numerical | |
3 | type. In this case, negative values wrap around to large positive values, | |
4 | which can be quite surprising in practice. However, as the cast works as | |
5 | defined, this lint is `Allow` by default. | |
6 | ||
7 | ### Why is this bad? | |
8 | Possibly surprising results. You can activate this lint | |
9 | as a one-time check to see where numerical wrapping can arise. | |
10 | ||
11 | ### Example | |
12 | ``` | |
13 | let y: i8 = -1; | |
14 | y as u128; // will return 18446744073709551615 | |
15 | ``` |