diff options
| author | jumbatm <30644300+jumbatm@users.noreply.github.com> | 2020-08-16 10:41:59 +1000 |
|---|---|---|
| committer | jumbatm <30644300+jumbatm@users.noreply.github.com> | 2020-08-18 02:01:04 +1000 |
| commit | a1fa4e05acb2cbda9a02cc34f8000c965328dbde (patch) | |
| tree | 5aa1165711f94b421ac1a998e7389c37896c7d0c /src | |
| parent | 154b74e8f959581d37d1a1ae860ee1bf7b682f34 (diff) | |
| download | rust-a1fa4e05acb2cbda9a02cc34f8000c965328dbde.tar.gz rust-a1fa4e05acb2cbda9a02cc34f8000c965328dbde.zip | |
Remove unnecessary rebinding of def ids.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/builtin.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 0e578ac5034..47f680932f1 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -2228,18 +2228,15 @@ impl ClashingExternDeclarations { }; match (a_kind, b_kind) { - (Adt(_, a_substs), Adt(_, b_substs)) => { + (Adt(a_def, a_substs), Adt(b_def, b_substs)) => { let a = a.subst(cx.tcx, a_substs); let b = b.subst(cx.tcx, b_substs); debug!("Comparing {:?} and {:?}", a, b); - if let (Adt(a_def, ..), Adt(b_def, ..)) = (&a.kind, &b.kind) { - // Grab a flattened representation of all fields. - let a_fields = - a_def.variants.iter().flat_map(|v| v.fields.iter()); - let b_fields = - b_def.variants.iter().flat_map(|v| v.fields.iter()); - compare_layouts(a, b) + // Grab a flattened representation of all fields. + let a_fields = a_def.variants.iter().flat_map(|v| v.fields.iter()); + let b_fields = b_def.variants.iter().flat_map(|v| v.fields.iter()); + compare_layouts(a, b) && a_fields.eq_by( b_fields, |&ty::FieldDef { did: a_did, .. }, @@ -2253,9 +2250,6 @@ impl ClashingExternDeclarations { ) }, ) - } else { - unreachable!() - } } (Array(a_ty, a_const), Array(b_ty, b_const)) => { // For arrays, we also check the constness of the type. |
