Run rustfix

This commit is contained in:
Yuki Okushi 2019-09-05 22:45:52 +09:00
parent 8be37fdb1d
commit 0b3f452764
3 changed files with 23 additions and 1 deletions

21
tests/ui/patterns.fixed Normal file
View File

@ -0,0 +1,21 @@
// run-rustfix
#![allow(unused)]
#![warn(clippy::all)]
#![feature(slice_patterns)]
fn main() {
let v = Some(true);
let s = [0, 1, 2, 3, 4];
match v {
Some(x) => (),
y => (),
}
match v {
Some(x) => (),
y @ None => (), // no error
}
match s {
[x, inside @ .., y] => (), // no error
[..] => (),
}
}

View File

@ -1,3 +1,4 @@
// run-rustfix
#![allow(unused)] #![allow(unused)]
#![warn(clippy::all)] #![warn(clippy::all)]
#![feature(slice_patterns)] #![feature(slice_patterns)]

View File

@ -1,5 +1,5 @@
error: the `y @ _` pattern can be written as just `y` error: the `y @ _` pattern can be written as just `y`
--> $DIR/patterns.rs:10:9 --> $DIR/patterns.rs:11:9
| |
LL | y @ _ => (), LL | y @ _ => (),
| ^^^^^ help: try: `y` | ^^^^^ help: try: `y`