Skip to content

Commit 1c11035

Browse files
committed
Polished lint and tests
1 parent 4d03b4d commit 1c11035

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/ui/implicit_saturating_sub.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(unused_assignments, unused_mut)]
2+
#![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)]
33
#![warn(clippy::implicit_saturating_sub)]
44

55
fn main() {

tests/ui/implicit_saturating_sub.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(unused_assignments, unused_mut)]
2+
#![allow(unused_assignments, unused_mut, clippy::assign_op_pattern)]
33
#![warn(clippy::implicit_saturating_sub)]
44

55
fn main() {
@@ -11,7 +11,7 @@ fn main() {
1111

1212
// Lint
1313
if u_8 > 0 {
14-
u_8 -= 1;
14+
u_8 = u_8 - 1;
1515
}
1616

1717
match end_8 {

tests/ui/implicit_saturating_sub.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Implicitly performing saturating subtraction
22
--> $DIR/implicit_saturating_sub.rs:13:5
33
|
44
LL | / if u_8 > 0 {
5-
LL | | u_8 -= 1;
5+
LL | | u_8 = u_8 - 1;
66
LL | | }
77
| |_____^ help: try: `u_8 = u_8.saturating_sub(1);`
88
|

0 commit comments

Comments
 (0)