mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +00:00
2b562dece6
Revert "Fix span issue on `implicit_saturating_sub`"
This reverts commit 140a1275f2
.
29 lines
1.1 KiB
Text
29 lines
1.1 KiB
Text
error: manual arithmetic check found
|
|
--> tests/ui/manual_arithmetic_check.rs:9:18
|
|
|
|
|
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
|
|
--> tests/ui/manual_arithmetic_check.rs:11:18
|
|
|
|
|
LL | let result = if b < a { a - b } else { 0 };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
error: manual arithmetic check found
|
|
--> tests/ui/manual_arithmetic_check.rs:14:18
|
|
|
|
|
LL | let result = if a < b { 0 } else { a - b };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `a.saturating_sub(b)`
|
|
|
|
error: manual arithmetic check found
|
|
--> tests/ui/manual_arithmetic_check.rs:16:18
|
|
|
|
|
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
|
|
|