Fix some rustfmt screwups
This commit is contained in:
parent
4a9cb3395d
commit
cf1cdadc77
@ -52,15 +52,14 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<Tokens, Str
|
||||
}
|
||||
};
|
||||
|
||||
Ok(
|
||||
quote! {
|
||||
let generated = quote! {
|
||||
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
||||
const #dummy_const: () = {
|
||||
extern crate serde as _serde;
|
||||
#impl_block
|
||||
};
|
||||
},
|
||||
)
|
||||
};
|
||||
Ok(generated)
|
||||
}
|
||||
|
||||
struct Parameters {
|
||||
@ -629,8 +628,8 @@ fn deserialize_externally_tagged_enum(
|
||||
let block = Match(deserialize_externally_tagged_variant(params, variant, cattrs),);
|
||||
|
||||
quote! {
|
||||
(__Field::#variant_name, __variant) => #block
|
||||
}
|
||||
(__Field::#variant_name, __variant) => #block
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -788,8 +787,8 @@ fn deserialize_adjacently_tagged_enum(
|
||||
);
|
||||
|
||||
quote! {
|
||||
__Field::#variant_index => #block
|
||||
}
|
||||
__Field::#variant_index => #block
|
||||
}
|
||||
},
|
||||
)
|
||||
.collect();
|
||||
@ -820,8 +819,8 @@ fn deserialize_adjacently_tagged_enum(
|
||||
} else {
|
||||
Some(
|
||||
quote! {
|
||||
_ => #missing_content
|
||||
},
|
||||
_ => #missing_content
|
||||
},
|
||||
)
|
||||
};
|
||||
let arms = variants
|
||||
@ -833,8 +832,8 @@ fn deserialize_adjacently_tagged_enum(
|
||||
let variant_index = field_i(i);
|
||||
let variant_ident = &variant.ident;
|
||||
quote! {
|
||||
__Field::#variant_index => _serde::export::Ok(#this::#variant_ident),
|
||||
}
|
||||
__Field::#variant_index => _serde::export::Ok(#this::#variant_ident),
|
||||
}
|
||||
},
|
||||
);
|
||||
missing_content = quote! {
|
||||
@ -1465,8 +1464,8 @@ fn deserialize_map(
|
||||
|&(field, ref name)| {
|
||||
let field_ty = &field.ty;
|
||||
quote! {
|
||||
let mut #name: _serde::export::Option<#field_ty> = _serde::export::None;
|
||||
}
|
||||
let mut #name: _serde::export::Option<#field_ty> = _serde::export::None;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@ -1541,11 +1540,11 @@ fn deserialize_map(
|
||||
let missing_expr = Match(expr_is_missing(&field, cattrs));
|
||||
|
||||
quote! {
|
||||
let #name = match #name {
|
||||
_serde::export::Some(#name) => #name,
|
||||
_serde::export::None => #missing_expr
|
||||
};
|
||||
}
|
||||
let #name = match #name {
|
||||
_serde::export::Some(#name) => #name,
|
||||
_serde::export::None => #missing_expr
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -51,15 +51,14 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<Tokens, Strin
|
||||
}
|
||||
};
|
||||
|
||||
Ok(
|
||||
quote! {
|
||||
let generated = quote! {
|
||||
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
||||
const #dummy_const: () = {
|
||||
extern crate serde as _serde;
|
||||
#impl_block
|
||||
};
|
||||
},
|
||||
)
|
||||
};
|
||||
Ok(generated)
|
||||
}
|
||||
|
||||
fn precondition(cx: &Ctxt, cont: &Container) {
|
||||
@ -518,12 +517,12 @@ fn serialize_adjacently_tagged_variant(
|
||||
match variant.style {
|
||||
Style::Unit => {
|
||||
return quote_block! {
|
||||
let mut __struct = try!(_serde::Serializer::serialize_struct(
|
||||
__serializer, #type_name, 1));
|
||||
try!(_serde::ser::SerializeStruct::serialize_field(
|
||||
&mut __struct, #tag, #variant_name));
|
||||
_serde::ser::SerializeStruct::end(__struct)
|
||||
};
|
||||
let mut __struct = try!(_serde::Serializer::serialize_struct(
|
||||
__serializer, #type_name, 1));
|
||||
try!(_serde::ser::SerializeStruct::serialize_field(
|
||||
&mut __struct, #tag, #variant_name));
|
||||
_serde::ser::SerializeStruct::end(__struct)
|
||||
};
|
||||
}
|
||||
Style::Newtype => {
|
||||
let field = &variant.fields[0];
|
||||
@ -533,8 +532,8 @@ fn serialize_adjacently_tagged_variant(
|
||||
}
|
||||
|
||||
quote_expr! {
|
||||
_serde::Serialize::serialize(#field_expr, __serializer)
|
||||
}
|
||||
_serde::Serialize::serialize(#field_expr, __serializer)
|
||||
}
|
||||
}
|
||||
Style::Tuple => {
|
||||
serialize_tuple_variant(TupleVariant::Untagged, params, &variant.fields)
|
||||
@ -812,8 +811,8 @@ fn serialize_tuple_struct_visitor(
|
||||
}
|
||||
|
||||
let ser = quote! {
|
||||
try!(#func(&mut __serde_state, #field_expr));
|
||||
};
|
||||
try!(#func(&mut __serde_state, #field_expr));
|
||||
};
|
||||
|
||||
match skip {
|
||||
None => ser,
|
||||
@ -854,8 +853,8 @@ fn serialize_struct_visitor(
|
||||
}
|
||||
|
||||
let ser = quote! {
|
||||
try!(#func(&mut __serde_state, #key_expr, #field_expr));
|
||||
};
|
||||
try!(#func(&mut __serde_state, #key_expr, #field_expr));
|
||||
};
|
||||
|
||||
match skip {
|
||||
None => ser,
|
||||
|
Loading…
x
Reference in New Issue
Block a user