|
| 1 | +error: reverted arithmetic check before subtraction |
| 2 | + --> tests/ui/manual_arithmetic_check-2.rs:8:21 |
| 3 | + | |
| 4 | +LL | let result = if a > b { b - a } else { 0 }; |
| 5 | + | ^^^^^ ----- help: try replacing it with: `a - b` |
| 6 | + | |
| 7 | +note: you check that `a` is bigger than `b` |
| 8 | + --> tests/ui/manual_arithmetic_check-2.rs:8:21 |
| 9 | + | |
| 10 | +LL | let result = if a > b { b - a } else { 0 }; |
| 11 | + | ^^^^^ |
| 12 | +note: but then you subtract `a` from `b` |
| 13 | + --> tests/ui/manual_arithmetic_check-2.rs:8:29 |
| 14 | + | |
| 15 | +LL | let result = if a > b { b - a } else { 0 }; |
| 16 | + | ^^^^^ |
| 17 | + = note: `-D clippy::manual-arithmetic-check` implied by `-D warnings` |
| 18 | + = help: to override `-D warnings` add `#[allow(clippy::manual_arithmetic_check)]` |
| 19 | + |
| 20 | +error: reverted arithmetic check before subtraction |
| 21 | + --> tests/ui/manual_arithmetic_check-2.rs:10:21 |
| 22 | + | |
| 23 | +LL | let result = if b < a { b - a } else { 0 }; |
| 24 | + | ^^^^^ ----- help: try replacing it with: `a - b` |
| 25 | + | |
| 26 | +note: you check that `a` is bigger than `b` |
| 27 | + --> tests/ui/manual_arithmetic_check-2.rs:10:21 |
| 28 | + | |
| 29 | +LL | let result = if b < a { b - a } else { 0 }; |
| 30 | + | ^^^^^ |
| 31 | +note: but then you subtract `a` from `b` |
| 32 | + --> tests/ui/manual_arithmetic_check-2.rs:10:29 |
| 33 | + | |
| 34 | +LL | let result = if b < a { b - a } else { 0 }; |
| 35 | + | ^^^^^ |
| 36 | + |
| 37 | +error: reverted arithmetic check before subtraction |
| 38 | + --> tests/ui/manual_arithmetic_check-2.rs:13:21 |
| 39 | + | |
| 40 | +LL | let result = if a > b { 0 } else { a - b }; |
| 41 | + | ^^^^^ ----- help: try replacing it with: `b - a` |
| 42 | + | |
| 43 | +note: you check that `b` is bigger than `a` |
| 44 | + --> tests/ui/manual_arithmetic_check-2.rs:13:21 |
| 45 | + | |
| 46 | +LL | let result = if a > b { 0 } else { a - b }; |
| 47 | + | ^^^^^ |
| 48 | +note: but then you subtract `b` from `a` |
| 49 | + --> tests/ui/manual_arithmetic_check-2.rs:13:40 |
| 50 | + | |
| 51 | +LL | let result = if a > b { 0 } else { a - b }; |
| 52 | + | ^^^^^ |
| 53 | + |
| 54 | +error: reverted arithmetic check before subtraction |
| 55 | + --> tests/ui/manual_arithmetic_check-2.rs:15:21 |
| 56 | + | |
| 57 | +LL | let result = if b < a { 0 } else { a - b }; |
| 58 | + | ^^^^^ ----- help: try replacing it with: `b - a` |
| 59 | + | |
| 60 | +note: you check that `b` is bigger than `a` |
| 61 | + --> tests/ui/manual_arithmetic_check-2.rs:15:21 |
| 62 | + | |
| 63 | +LL | let result = if b < a { 0 } else { a - b }; |
| 64 | + | ^^^^^ |
| 65 | +note: but then you subtract `b` from `a` |
| 66 | + --> tests/ui/manual_arithmetic_check-2.rs:15:40 |
| 67 | + | |
| 68 | +LL | let result = if b < a { 0 } else { a - b }; |
| 69 | + | ^^^^^ |
| 70 | + |
| 71 | +error: aborting due to 4 previous errors |
| 72 | + |
0 commit comments