Skip to content

Commit a1fa4e0

Browse files
committed
Remove unnecessary rebinding of def ids.
1 parent 154b74e commit a1fa4e0

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/librustc_lint/builtin.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,18 +2228,15 @@ impl ClashingExternDeclarations {
22282228
};
22292229

22302230
match (a_kind, b_kind) {
2231-
(Adt(_, a_substs), Adt(_, b_substs)) => {
2231+
(Adt(a_def, a_substs), Adt(b_def, b_substs)) => {
22322232
let a = a.subst(cx.tcx, a_substs);
22332233
let b = b.subst(cx.tcx, b_substs);
22342234
debug!("Comparing {:?} and {:?}", a, b);
22352235

2236-
if let (Adt(a_def, ..), Adt(b_def, ..)) = (&a.kind, &b.kind) {
2237-
// Grab a flattened representation of all fields.
2238-
let a_fields =
2239-
a_def.variants.iter().flat_map(|v| v.fields.iter());
2240-
let b_fields =
2241-
b_def.variants.iter().flat_map(|v| v.fields.iter());
2242-
compare_layouts(a, b)
2236+
// Grab a flattened representation of all fields.
2237+
let a_fields = a_def.variants.iter().flat_map(|v| v.fields.iter());
2238+
let b_fields = b_def.variants.iter().flat_map(|v| v.fields.iter());
2239+
compare_layouts(a, b)
22432240
&& a_fields.eq_by(
22442241
b_fields,
22452242
|&ty::FieldDef { did: a_did, .. },
@@ -2253,9 +2250,6 @@ impl ClashingExternDeclarations {
22532250
)
22542251
},
22552252
)
2256-
} else {
2257-
unreachable!()
2258-
}
22592253
}
22602254
(Array(a_ty, a_const), Array(b_ty, b_const)) => {
22612255
// For arrays, we also check the constness of the type.

0 commit comments

Comments
 (0)