2024-03-19 15:59:08 +00:00
|
|
|
error: manual arithmetic check found
|
2024-03-19 16:00:31 +00:00
|
|
|
--> tests/ui/manual_arithmetic_check.rs:9:18
|
2024-03-19 15:59:08 +00:00
|
|
|
|
|
|
|
|
LL | let result = if a > b { a - b } else { 0 };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::implicit_saturating_sub)]`
|
|
|
|
|
|
|
|
error: manual arithmetic check found
|
2024-03-19 16:00:31 +00:00
|
|
|
--> tests/ui/manual_arithmetic_check.rs:11:18
|
2024-03-19 15:59:08 +00:00
|
|
|
|
|
|
|
|
LL | let result = if b < a { a - b } else { 0 };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
|
|
|
|
error: manual arithmetic check found
|
2024-03-19 16:00:31 +00:00
|
|
|
--> tests/ui/manual_arithmetic_check.rs:14:18
|
2024-03-19 15:59:08 +00:00
|
|
|
|
|
|
|
|
LL | let result = if a < b { 0 } else { a - b };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
|
|
|
|
error: manual arithmetic check found
|
2024-03-19 16:00:31 +00:00
|
|
|
--> tests/ui/manual_arithmetic_check.rs:16:18
|
2024-03-19 15:59:08 +00:00
|
|
|
|
|
|
|
|
LL | let result = if b > a { 0 } else { a - b };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|