I have an enum of structs with named fields, like e.g.
enum Thing {
A { id: u8, name: String },
B { id: u8, data: String }
}
Using it in a match
produces unused variable warnings, when I do not use all fields in the corresponding block:
fn main() {
let a = Thing::A { id: 1, name: "Gloria".to_string() };
match a {
Thing::A {id, name} => println!("{}", name) , // unused variable `id`
Thing::B {id, data} => panic!("D'oh") // unused variabel `id`,`data`
}
}
How would I silence those?
2