]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/cast_sign_loss.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / cast_sign_loss.txt
CommitLineData
f2b60f7d
FG
1### What it does
2Checks for casts from a signed to an unsigned numerical
3type. In this case, negative values wrap around to large positive values,
4which can be quite surprising in practice. However, as the cast works as
5defined, this lint is `Allow` by default.
6
7### Why is this bad?
8Possibly surprising results. You can activate this lint
9as a one-time check to see where numerical wrapping can arise.
10
11### Example
12```
13let y: i8 = -1;
14y as u128; // will return 18446744073709551615
15```