mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Polished lint and tests
This commit is contained in:
parent
4d03b4d2f0
commit
1c1103561e
3 changed files with 4 additions and 4 deletions
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);`
|
||||
|
|
||||
|
|
Loading…
Add table
Reference in a new issue