| error: inverted arithmetic check before subtraction |
| --> tests/ui/manual_arithmetic_check-2.rs:8: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:8:29 |
| | |
| LL | let result = if a > b { b - a } else { 0 }; |
| | ^^^^^ |
| = note: `#[deny(clippy::inverted_saturating_sub)]` on by default |
| |
| 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:17: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:17:41 |
| | |
| LL | let result = if a >= b { 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:40 |
| | |
| LL | let result = if b < a { 0 } else { a - b }; |
| | ^^^^^ |
| |
| error: inverted arithmetic check before subtraction |
| --> tests/ui/manual_arithmetic_check-2.rs:23: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:23:41 |
| | |
| LL | let result = if b <= a { 0 } else { a - b }; |
| | ^^^^^ |
| |
| error: inverted arithmetic check before subtraction |
| --> tests/ui/manual_arithmetic_check-2.rs:26:27 |
| | |
| LL | let result = if b * 2 <= a { 0 } else { a - b * 2 }; |
| | ^^ --------- help: try replacing it with: `b * 2 - a` |
| | |
| note: this subtraction underflows when `a < b * 2` |
| --> tests/ui/manual_arithmetic_check-2.rs:26:45 |
| | |
| LL | let result = if b * 2 <= a { 0 } else { a - b * 2 }; |
| | ^^^^^^^^^ |
| |
| error: inverted arithmetic check before subtraction |
| --> tests/ui/manual_arithmetic_check-2.rs:29:23 |
| | |
| LL | let result = if b <= a * 2 { 0 } else { a * 2 - b }; |
| | ^^ --------- help: try replacing it with: `b - a * 2` |
| | |
| note: this subtraction underflows when `a * 2 < b` |
| --> tests/ui/manual_arithmetic_check-2.rs:29:45 |
| | |
| LL | let result = if b <= a * 2 { 0 } else { a * 2 - b }; |
| | ^^^^^^^^^ |
| |
| error: inverted arithmetic check before subtraction |
| --> tests/ui/manual_arithmetic_check-2.rs:32:27 |
| | |
| LL | let result = if b + 3 <= a + 2 { 0 } else { (a + 2) - (b + 3) }; |
| | ^^ ----------------- help: try replacing it with: `b + 3 - (a + 2)` |
| | |
| note: this subtraction underflows when `a + 2 < b + 3` |
| --> tests/ui/manual_arithmetic_check-2.rs:32:49 |
| | |
| LL | let result = if b + 3 <= a + 2 { 0 } else { (a + 2) - (b + 3) }; |
| | ^^^^^^^^^^^^^^^^^ |
| |
| error: aborting due to 9 previous errors |
| |