~ireas/merge-rs

6d94559fafd98398ee4c8d0b7ade48533db68855 — Robin Krahl 2 months ago 1e22d53
Fix formatting for merge_derive
1 files changed, 8 insertions(+), 2 deletions(-)

M merge_derive/src/lib.rs
M merge_derive/src/lib.rs => merge_derive/src/lib.rs +8 -2
@@ 58,7 58,11 @@ fn impl_merge(ast: &syn::DeriveInput) -> TokenStream {
    }
}

fn impl_merge_for_struct(name: &syn::Ident, fields: &syn::Fields, default_strategy: FieldAttrs) -> TokenStream {
fn impl_merge_for_struct(
    name: &syn::Ident,
    fields: &syn::Fields,
    default_strategy: FieldAttrs,
) -> TokenStream {
    let assignments = gen_assignments(fields, default_strategy);

    quote! {


@@ 72,7 76,9 @@ fn impl_merge_for_struct(name: &syn::Ident, fields: &syn::Fields, default_strate

fn gen_assignments(fields: &syn::Fields, default_strategy: FieldAttrs) -> TokenStream {
    let fields = fields.iter().enumerate().map(Field::from);
    let assignments = fields.filter(|f| !f.attrs.skip).map(|f| gen_assignment(&f, &default_strategy));
    let assignments = fields
        .filter(|f| !f.attrs.skip)
        .map(|f| gen_assignment(&f, &default_strategy));
    quote! {
        #( #assignments )*
    }