Skip to content

Commit

Permalink
Revert "Remove unnecessary clone (#213)" (#219)
Browse files Browse the repository at this point in the history
This reverts commit 35950f5.
  • Loading branch information
bokuweb authored Apr 6, 2023
1 parent 5d4cbf5 commit 2851aa8
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions raiden-derive/src/ops/transact_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@ pub(crate) fn expand_transact_write(
// }
// });

let mut concatenated = TokenStream::new();
let iter = fields.named.clone().into_iter();
let mut i = 0;
for f in iter {
let ident = f.ident.expect("Expected a named field");
if !crate::finder::include_unary_attr(&f.attrs, "uuid") {
if i == 0 {
concatenated.append_all(quote! {#ident});
} else {
concatenated.append_all(quote! {, #ident});
}
i += 1
}
}

let bound = quote! {
let #item_input_name { #concatenated } = item;
};

let input_items = {
let insertion = fields.named.iter().map(|f| {
let ident = &f.ident.clone().unwrap();
Expand All @@ -75,7 +56,7 @@ pub(crate) fn expand_transact_write(
}
} else {
quote! {
let value = #ident.into_attr();
let value = item.#ident.into_attr();
if !::raiden::is_attr_value_empty(&value) {
input_item.insert(
#attr_key.to_string(),
Expand All @@ -87,7 +68,6 @@ pub(crate) fn expand_transact_write(
});

quote! {
#bound
let mut input_item: std::collections::HashMap<String, raiden::AttributeValue> = std::collections::HashMap::new();
#(#insertion)*
}
Expand Down

0 comments on commit 2851aa8

Please sign in to comment.