rust-clippy/tests/ui/implicit_saturating_sub.stderr
blyxyas 2b562dece6 Fix suggestion with a less volatile approach
Revert "Fix span issue on `implicit_saturating_sub`"
This reverts commit 140a1275f2.
2024-10-12 17:43:06 +02:00

200 lines
5.7 KiB
Text

error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:27:5
|
LL | / if u_8 > 0 {
LL | | u_8 = u_8 - 1;
LL | | }
| |_____^ help: try: `u_8 = u_8.saturating_sub(1);`
|
= note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::implicit_saturating_sub)]`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:34:13
|
LL | / if u_8 > 0 {
LL | | u_8 -= 1;
LL | | }
| |_____________^ help: try: `u_8 = u_8.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:48:5
|
LL | / if u_16 > 0 {
LL | | u_16 -= 1;
LL | | }
| |_____^ help: try: `u_16 = u_16.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:58:5
|
LL | / if u_32 != 0 {
LL | | u_32 -= 1;
LL | | }
| |_____^ help: try: `u_32 = u_32.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:79:5
|
LL | / if u_64 > 0 {
LL | | u_64 -= 1;
LL | | }
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:84:5
|
LL | / if 0 < u_64 {
LL | | u_64 -= 1;
LL | | }
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:89:5
|
LL | / if 0 != u_64 {
LL | | u_64 -= 1;
LL | | }
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:110:5
|
LL | / if u_usize > 0 {
LL | | u_usize -= 1;
LL | | }
| |_____^ help: try: `u_usize = u_usize.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:122:5
|
LL | / if i_8 > i8::MIN {
LL | | i_8 -= 1;
LL | | }
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:127:5
|
LL | / if i_8 > i8::MIN {
LL | | i_8 -= 1;
LL | | }
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:132:5
|
LL | / if i_8 != i8::MIN {
LL | | i_8 -= 1;
LL | | }
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:137:5
|
LL | / if i_8 != i8::MIN {
LL | | i_8 -= 1;
LL | | }
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:147:5
|
LL | / if i_16 > i16::MIN {
LL | | i_16 -= 1;
LL | | }
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:152:5
|
LL | / if i_16 > i16::MIN {
LL | | i_16 -= 1;
LL | | }
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:157:5
|
LL | / if i_16 != i16::MIN {
LL | | i_16 -= 1;
LL | | }
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:162:5
|
LL | / if i_16 != i16::MIN {
LL | | i_16 -= 1;
LL | | }
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:172:5
|
LL | / if i_32 > i32::MIN {
LL | | i_32 -= 1;
LL | | }
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:177:5
|
LL | / if i_32 > i32::MIN {
LL | | i_32 -= 1;
LL | | }
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:182:5
|
LL | / if i_32 != i32::MIN {
LL | | i_32 -= 1;
LL | | }
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:187:5
|
LL | / if i_32 != i32::MIN {
LL | | i_32 -= 1;
LL | | }
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:197:5
|
LL | / if i64::MIN < i_64 {
LL | | i_64 -= 1;
LL | | }
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:202:5
|
LL | / if i64::MIN != i_64 {
LL | | i_64 -= 1;
LL | | }
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
error: implicitly performing saturating subtraction
--> tests/ui/implicit_saturating_sub.rs:207:5
|
LL | / if i64::MIN < i_64 {
LL | | i_64 -= 1;
LL | | }
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
error: manual arithmetic check found
--> tests/ui/implicit_saturating_sub.rs:275:12
|
LL | } else if a >= b {
| ____________^
LL | | 0
LL | | } else {
LL | | b - a
LL | | }
| |_____^ help: replace it with: `{ b.saturating_sub(a) }`
error: aborting due to 24 previous errors