mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-23 19:43:20 +00:00
189 lines
5.4 KiB
Text
189 lines
5.4 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: aborting due to 23 previous errors
|
|
|