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