]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary rebinding of def ids.
authorjumbatm <30644300+jumbatm@users.noreply.github.com>
Sun, 16 Aug 2020 00:41:59 +0000 (10:41 +1000)
committerjumbatm <30644300+jumbatm@users.noreply.github.com>
Mon, 17 Aug 2020 16:01:04 +0000 (02:01 +1000)
src/librustc_lint/builtin.rs

index 0e578ac5034db2e577cceea74722313344273304..47f680932f14ea86506516a58549dac2af4c9236 100644 (file)
@@ -2228,18 +2228,15 @@ fn structurally_same_type_impl<'tcx>(
                         };
 
                         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 @@ fn structurally_same_type_impl<'tcx>(
                                     )
                                 },
                             )
-                                } else {
-                                    unreachable!()
-                                }
                             }
                             (Array(a_ty, a_const), Array(b_ty, b_const)) => {
                                 // For arrays, we also check the constness of the type.