rust-clippy/tests/ui/patterns.rs
Matthias Krüger b2c4f09d77 rustup https://github.com/rust-lang/rust/pull/67712
slice_patterns have been stabilized.
2020-01-18 23:43:28 +01:00

20 lines
353 B
Rust

// run-rustfix
#![allow(unused)]
#![warn(clippy::all)]
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
[..] => (),
}
}