From 1c1103561ea3ce6d9ddba97061496a25884ee671 Mon Sep 17 00:00:00 2001 From: pmk21 Date: Sat, 18 Apr 2020 01:16:32 +0530 Subject: [PATCH] Polished lint and tests --- tests/ui/implicit_saturating_sub.fixed | 2 +- tests/ui/implicit_saturating_sub.rs | 4 ++-- tests/ui/implicit_saturating_sub.stderr | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/ui/implicit_saturating_sub.fixed b/tests/ui/implicit_saturating_sub.fixed index 830d180442e5..fd4ba71f6afc 100644 --- a/tests/ui/implicit_saturating_sub.fixed +++ b/tests/ui/implicit_saturating_sub.fixed @@ -1,5 +1,5 @@ // run-rustfix -#![allow(unused_assignments, unused_mut)] +#![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)] #![warn(clippy::implicit_saturating_sub)] fn main() { diff --git a/tests/ui/implicit_saturating_sub.rs b/tests/ui/implicit_saturating_sub.rs index 36da4f97163a..56c1be005c04 100644 --- a/tests/ui/implicit_saturating_sub.rs +++ b/tests/ui/implicit_saturating_sub.rs @@ -1,5 +1,5 @@ // run-rustfix -#![allow(unused_assignments, unused_mut)] +#![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)] #![warn(clippy::implicit_saturating_sub)] fn main() { @@ -11,7 +11,7 @@ fn main() { // Lint if u_8 > 0 { - u_8 -= 1; + u_8 = u_8 - 1; } match end_8 { diff --git a/tests/ui/implicit_saturating_sub.stderr b/tests/ui/implicit_saturating_sub.stderr index 256dbe0c245f..a8ba870b1dda 100644 --- a/tests/ui/implicit_saturating_sub.stderr +++ b/tests/ui/implicit_saturating_sub.stderr @@ -2,7 +2,7 @@ error: Implicitly performing saturating subtraction --> $DIR/implicit_saturating_sub.rs:13:5 | LL | / if u_8 > 0 { -LL | | u_8 -= 1; +LL | | u_8 = u_8 - 1; LL | | } | |_____^ help: try: `u_8 = u_8.saturating_sub(1);` |