};
let fields = ty::lookup_struct_fields(self.tcx, id);
for pat in pats {
+ if let ast::PatWild(ast::PatWildSingle) = pat.node.pat.node {
+ continue;
+ }
let field_id = fields.iter()
.find(|field| field.name == pat.node.ident.name).unwrap().id;
self.live_symbols.insert(field_id.node);
X, //~ ERROR variant is never used
Y { //~ ERROR variant is never used
a: String,
- b: isize //~ ERROR: struct field is never used
+ b: i32, //~ ERROR: struct field is never used
+ c: i32, //~ ERROR: struct field is never used
},
Z
}
fn field_match_in_patterns(b: XYZ) -> String {
match b {
- XYZ::Y { a, .. } => a,
+ XYZ::Y { a, b: _, .. } => a,
_ => "".to_string()
}
}
struct Bar {
x: usize, //~ ERROR: struct field is never used
b: bool,
+ c: bool, //~ ERROR: struct field is never used
_guard: ()
}
}
fn field_match_in_let(f: Bar) -> bool {
- let Bar { b, .. } = f;
+ let Bar { b, c: _, .. } = f;
b
}
fn main() {
field_read(Foo { x: 1, b: false });
field_match_in_patterns(XYZ::Z);
- field_match_in_let(Bar { x: 42, b: true, _guard: () });
+ field_match_in_let(Bar { x: 42, b: true, c: false, _guard: () });
let _ = Baz { x: 0 };
}