mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
implicit-saturating-sub: make lint adhere to lint message convention
This commit is contained in:
parent
f171f89aed
commit
bdf4dc3abd
2 changed files with 25 additions and 25 deletions
|
@ -158,9 +158,9 @@ fn print_lint_and_sugg(cx: &LateContext<'_>, var_name: &str, expr: &Expr<'_>) {
|
|||
cx,
|
||||
IMPLICIT_SATURATING_SUB,
|
||||
expr.span,
|
||||
"Implicitly performing saturating subtraction",
|
||||
"implicitly performing saturating subtraction",
|
||||
"try",
|
||||
format!("{} = {}.saturating_sub({});", var_name, var_name, 1.to_string()),
|
||||
format!("{} = {}.saturating_sub({});", var_name, var_name, '1'),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:13:5
|
||||
|
|
||||
LL | / if u_8 > 0 {
|
||||
|
@ -8,7 +8,7 @@ LL | | }
|
|||
|
|
||||
= note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:20:13
|
||||
|
|
||||
LL | / if u_8 > 0 {
|
||||
|
@ -16,7 +16,7 @@ LL | | u_8 -= 1;
|
|||
LL | | }
|
||||
| |_____________^ help: try: `u_8 = u_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:34:5
|
||||
|
|
||||
LL | / if u_16 > 0 {
|
||||
|
@ -24,7 +24,7 @@ LL | | u_16 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_16 = u_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:44:5
|
||||
|
|
||||
LL | / if u_32 != 0 {
|
||||
|
@ -32,7 +32,7 @@ LL | | u_32 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_32 = u_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:65:5
|
||||
|
|
||||
LL | / if u_64 > 0 {
|
||||
|
@ -40,7 +40,7 @@ LL | | u_64 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:70:5
|
||||
|
|
||||
LL | / if 0 < u_64 {
|
||||
|
@ -48,7 +48,7 @@ LL | | u_64 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:75:5
|
||||
|
|
||||
LL | / if 0 != u_64 {
|
||||
|
@ -56,7 +56,7 @@ LL | | u_64 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:96:5
|
||||
|
|
||||
LL | / if u_usize > 0 {
|
||||
|
@ -64,7 +64,7 @@ LL | | u_usize -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `u_usize = u_usize.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:108:5
|
||||
|
|
||||
LL | / if i_8 > i8::MIN {
|
||||
|
@ -72,7 +72,7 @@ LL | | i_8 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:113:5
|
||||
|
|
||||
LL | / if i_8 > i8::MIN {
|
||||
|
@ -80,7 +80,7 @@ LL | | i_8 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:118:5
|
||||
|
|
||||
LL | / if i_8 != i8::MIN {
|
||||
|
@ -88,7 +88,7 @@ LL | | i_8 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:123:5
|
||||
|
|
||||
LL | / if i_8 != i8::MIN {
|
||||
|
@ -96,7 +96,7 @@ LL | | i_8 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:133:5
|
||||
|
|
||||
LL | / if i_16 > i16::MIN {
|
||||
|
@ -104,7 +104,7 @@ LL | | i_16 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:138:5
|
||||
|
|
||||
LL | / if i_16 > i16::MIN {
|
||||
|
@ -112,7 +112,7 @@ LL | | i_16 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:143:5
|
||||
|
|
||||
LL | / if i_16 != i16::MIN {
|
||||
|
@ -120,7 +120,7 @@ LL | | i_16 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:148:5
|
||||
|
|
||||
LL | / if i_16 != i16::MIN {
|
||||
|
@ -128,7 +128,7 @@ LL | | i_16 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:158:5
|
||||
|
|
||||
LL | / if i_32 > i32::MIN {
|
||||
|
@ -136,7 +136,7 @@ LL | | i_32 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:163:5
|
||||
|
|
||||
LL | / if i_32 > i32::MIN {
|
||||
|
@ -144,7 +144,7 @@ LL | | i_32 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:168:5
|
||||
|
|
||||
LL | / if i_32 != i32::MIN {
|
||||
|
@ -152,7 +152,7 @@ LL | | i_32 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:173:5
|
||||
|
|
||||
LL | / if i_32 != i32::MIN {
|
||||
|
@ -160,7 +160,7 @@ LL | | i_32 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:183:5
|
||||
|
|
||||
LL | / if i64::MIN < i_64 {
|
||||
|
@ -168,7 +168,7 @@ LL | | i_64 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:188:5
|
||||
|
|
||||
LL | / if i64::MIN != i_64 {
|
||||
|
@ -176,7 +176,7 @@ LL | | i_64 -= 1;
|
|||
LL | | }
|
||||
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:193:5
|
||||
|
|
||||
LL | / if i64::MIN < i_64 {
|
||||
|
|
Loading…
Reference in a new issue