77 lines
2.8 KiB
Plaintext
77 lines
2.8 KiB
Plaintext
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:9:23
|
||
|
|
|
||
|
LL | let result = if a > b { b - a } else { 0 };
|
||
|
| ^ ----- help: try replacing it with: `a - b`
|
||
|
|
|
||
|
note: this subtraction underflows when `b < a`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:9:29
|
||
|
|
|
||
|
LL | let result = if a > b { b - a } else { 0 };
|
||
|
| ^^^^^
|
||
|
= note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
|
||
|
= help: to override `-D warnings` add `#[allow(clippy::implicit_saturating_sub)]`
|
||
|
|
||
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:11:23
|
||
|
|
|
||
|
LL | let result = if b < a { b - a } else { 0 };
|
||
|
| ^ ----- help: try replacing it with: `a - b`
|
||
|
|
|
||
|
note: this subtraction underflows when `b < a`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:11:29
|
||
|
|
|
||
|
LL | let result = if b < a { b - a } else { 0 };
|
||
|
| ^^^^^
|
||
|
|
||
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:14:23
|
||
|
|
|
||
|
LL | let result = if a > b { 0 } else { a - b };
|
||
|
| ^ ----- help: try replacing it with: `b - a`
|
||
|
|
|
||
|
note: this subtraction underflows when `a < b`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:14:40
|
||
|
|
|
||
|
LL | let result = if a > b { 0 } else { a - b };
|
||
|
| ^^^^^
|
||
|
|
||
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:16:23
|
||
|
|
|
||
|
LL | let result = if a >= b { 0 } else { a - b };
|
||
|
| ^^ ----- help: try replacing it with: `b - a`
|
||
|
|
|
||
|
note: this subtraction underflows when `a < b`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:16:41
|
||
|
|
|
||
|
LL | let result = if a >= b { 0 } else { a - b };
|
||
|
| ^^^^^
|
||
|
|
||
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:18:23
|
||
|
|
|
||
|
LL | let result = if b < a { 0 } else { a - b };
|
||
|
| ^ ----- help: try replacing it with: `b - a`
|
||
|
|
|
||
|
note: this subtraction underflows when `a < b`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:18:40
|
||
|
|
|
||
|
LL | let result = if b < a { 0 } else { a - b };
|
||
|
| ^^^^^
|
||
|
|
||
|
error: inverted arithmetic check before subtraction
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:20:23
|
||
|
|
|
||
|
LL | let result = if b <= a { 0 } else { a - b };
|
||
|
| ^^ ----- help: try replacing it with: `b - a`
|
||
|
|
|
||
|
note: this subtraction underflows when `a < b`
|
||
|
--> tests/ui/manual_arithmetic_check-2.rs:20:41
|
||
|
|
|
||
|
LL | let result = if b <= a { 0 } else { a - b };
|
||
|
| ^^^^^
|
||
|
|
||
|
error: aborting due to 6 previous errors
|
||
|
|