Skip to content

Commit 8602dfc

Browse files
committed
fix(stackable-versioned): Remove type comparison and use into() on all field conversions
Note: the from/to type comparison was smentically invalid as we have no information of the actual type which might still be an equivalent string (eg: foo::TypeA could be defined in two versions of a crate).
1 parent 5dcb07b commit 8602dfc

File tree

1 file changed

+5
-12
lines changed
  • crates/stackable-versioned-macros/src/codegen/item

1 file changed

+5
-12
lines changed

crates/stackable-versioned-macros/src/codegen/item/field.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,26 +168,19 @@ impl VersionedField {
168168
ItemStatus::Change {
169169
from_ident: old_field_ident,
170170
to_ident,
171-
from_type,
172-
to_type,
171+
..
173172
},
174173
) => {
175-
if from_type == to_type {
176-
quote! {
177-
#to_ident: #from_struct_ident.#old_field_ident,
178-
}
179-
} else {
180-
quote! {
181-
#to_ident: #from_struct_ident.#old_field_ident.into(),
182-
}
174+
quote! {
175+
#to_ident: #from_struct_ident.#old_field_ident.into(),
183176
}
184177
}
185178
(old, next) => {
186179
let next_field_ident = next.get_ident();
187180
let old_field_ident = old.get_ident();
188181

189182
quote! {
190-
#next_field_ident: #from_struct_ident.#old_field_ident,
183+
#next_field_ident: #from_struct_ident.#old_field_ident.into(),
191184
}
192185
}
193186
}
@@ -196,7 +189,7 @@ impl VersionedField {
196189
let field_ident = &*self.ident;
197190

198191
quote! {
199-
#field_ident: #from_struct_ident.#field_ident,
192+
#field_ident: #from_struct_ident.#field_ident.into(),
200193
}
201194
}
202195
}

0 commit comments

Comments
 (0)