rust/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.rs
2023-01-11 09:32:08 +00:00

17 lines
333 B
Rust

#![feature(if_let_guard)]
#![deny(irrefutable_let_patterns)]
fn main() {
if let _ = 5 {} //~ ERROR irrefutable `if let` pattern
while let _ = 5 { //~ ERROR irrefutable `while let` pattern
break;
}
match 5 {
_ if let _ = 2 => {} //~ ERROR irrefutable `if let` guard pattern
_ => {}
}
}