rust/tests/ui/let-else/let-else-allow-in-expr.rs
2023-01-11 09:32:08 +00:00

29 lines
506 B
Rust

#![deny(unused_variables)]
fn main() {
let Some(_): Option<u32> = ({
let x = 1; //~ ERROR unused variable: `x`
Some(1)
}) else {
return;
};
#[allow(unused_variables)]
let Some(_): Option<u32> = ({
let x = 1;
Some(1)
}) else {
return;
};
let Some(_): Option<u32> = ({
#[allow(unused_variables)]
let x = 1;
Some(1)
}) else {
return;
};
let x = 1; //~ ERROR unused variable: `x`
}