diff options
Diffstat (limited to 'gcc/rust/expand/rust-derive-eq.cc')
-rw-r--r-- | gcc/rust/expand/rust-derive-eq.cc | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/gcc/rust/expand/rust-derive-eq.cc b/gcc/rust/expand/rust-derive-eq.cc index 9765127..7da137f 100644 --- a/gcc/rust/expand/rust-derive-eq.cc +++ b/gcc/rust/expand/rust-derive-eq.cc @@ -142,10 +142,7 @@ DeriveEq::visit_tuple (TupleStruct &item) auto types = std::vector<std::unique_ptr<Type>> (); for (auto &field : item.get_fields ()) - { - auto type = Builder::new_type (field.get_field_type ()); - types.emplace_back (std::move (type)); - } + types.emplace_back (field.get_field_type ().reconstruct ()); expanded = eq_impls (assert_receiver_is_total_eq_fn (std::move (types)), item.get_identifier ().as_string (), @@ -158,10 +155,7 @@ DeriveEq::visit_struct (StructStruct &item) auto types = std::vector<std::unique_ptr<Type>> (); for (auto &field : item.get_fields ()) - { - auto type = Builder::new_type (field.get_field_type ()); - types.emplace_back (std::move (type)); - } + types.emplace_back (field.get_field_type ().reconstruct ()); expanded = eq_impls (assert_receiver_is_total_eq_fn (std::move (types)), item.get_identifier ().as_string (), @@ -186,10 +180,7 @@ DeriveEq::visit_enum (Enum &item) auto &tuple = static_cast<EnumItemTuple &> (*variant); for (auto &field : tuple.get_tuple_fields ()) - { - auto type = Builder::new_type (field.get_field_type ()); - types.emplace_back (std::move (type)); - } + types.emplace_back (field.get_field_type ().reconstruct ()); break; } case EnumItem::Kind::Struct: @@ -197,10 +188,7 @@ DeriveEq::visit_enum (Enum &item) auto &tuple = static_cast<EnumItemStruct &> (*variant); for (auto &field : tuple.get_struct_fields ()) - { - auto type = Builder::new_type (field.get_field_type ()); - types.emplace_back (std::move (type)); - } + types.emplace_back (field.get_field_type ().reconstruct ()); break; } @@ -218,10 +206,7 @@ DeriveEq::visit_union (Union &item) auto types = std::vector<std::unique_ptr<Type>> (); for (auto &field : item.get_variants ()) - { - auto type = Builder::new_type (field.get_field_type ()); - types.emplace_back (std::move (type)); - } + types.emplace_back (field.get_field_type ().reconstruct ()); expanded = eq_impls (assert_receiver_is_total_eq_fn (std::move (types)), item.get_identifier ().as_string (), |