This match feature is awful

You can apply attributes in Rust only to a specific scope:

enum Foo {
    A,
    B,
}

fn foo(foo: Foo) {
    use Foo::*;

    let x = 123; // only a warning

    #[deny(unused_variables)]
    match foo {
        A => println!("A"),
        C => println!("B"), // compilation fails with error
    }
}
7 Likes