mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
188 lines
5.3 KiB
Text
188 lines
5.3 KiB
Text
error: Implicitly performing saturating subtraction
|
|
--> $DIR/implicit_saturating_sub.rs:13: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`
|
|
|
|
error: Implicitly performing saturating subtraction
|
|
--> $DIR/implicit_saturating_sub.rs:20: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
|
|
--> $DIR/implicit_saturating_sub.rs:34: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
|
|
--> $DIR/implicit_saturating_sub.rs:44: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
|
|
--> $DIR/implicit_saturating_sub.rs:65: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
|
|
--> $DIR/implicit_saturating_sub.rs:70: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
|
|
--> $DIR/implicit_saturating_sub.rs:75: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
|
|
--> $DIR/implicit_saturating_sub.rs:96: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
|
|
--> $DIR/implicit_saturating_sub.rs:108: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
|
|
--> $DIR/implicit_saturating_sub.rs:113: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
|
|
--> $DIR/implicit_saturating_sub.rs:118: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
|
|
--> $DIR/implicit_saturating_sub.rs:123: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
|
|
--> $DIR/implicit_saturating_sub.rs:133: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
|
|
--> $DIR/implicit_saturating_sub.rs:138: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
|
|
--> $DIR/implicit_saturating_sub.rs:143: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
|
|
--> $DIR/implicit_saturating_sub.rs:148: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
|
|
--> $DIR/implicit_saturating_sub.rs:158: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
|
|
--> $DIR/implicit_saturating_sub.rs:163: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
|
|
--> $DIR/implicit_saturating_sub.rs:168: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
|
|
--> $DIR/implicit_saturating_sub.rs:173: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
|
|
--> $DIR/implicit_saturating_sub.rs:183: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
|
|
--> $DIR/implicit_saturating_sub.rs:188: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
|
|
--> $DIR/implicit_saturating_sub.rs:193: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
|
|
|