Add lint check for negating uint literals and variables.

See #11273 and #13318
This commit is contained in:
Falco Hirschenberger 2014-05-03 00:13:26 +02:00
parent 239557de6d
commit 6c26cbb602
14 changed files with 58 additions and 3 deletions

View file

@ -36,3 +36,14 @@ fn qux() {
i += 1;
}
}
fn quy() {
let i = -23u; //~ WARNING negation of unsigned int literal may be unintentional
//~^ WARNING unused variable
}
fn quz() {
let i = 23u;
let j = -i; //~ WARNING negation of unsigned int variable may be unintentional
//~^ WARNING unused variable
}