Cleanup palooza

This commit is contained in:
Erick Tryzelaar 2015-03-15 15:14:57 -07:00
parent b628446768
commit cbafc83af4

View File

@ -484,7 +484,9 @@ fn deserialize_field_visitor(
field_names: &[ast::Ident],
struct_def: &StructDef,
) -> Vec<P<ast::Item>> {
let field_enum = builder.item().enum_("__Field")
let field_enum = builder.item()
.attr().allow(&["non_camel_case_types"])
.enum_("__Field")
.with_variants(
field_names.iter().map(|field| {
builder.variant(field).tuple().build()
@ -504,16 +506,16 @@ fn deserialize_field_visitor(
.collect();
vec![
quote_item!(cx,
#[allow(non_camel_case_types)]
$field_enum
).unwrap(),
field_enum,
quote_item!(cx,
impl ::serde::de::Deserialize for __Field {
#[inline]
fn deserialize<S>(state: &mut S) -> Result<__Field, S::Error>
where S: ::serde::de::Deserializer,
{
struct __FieldVisitor;
).unwrap(),
quote_item!(cx,
impl ::serde::de::Visitor for __FieldVisitor {
type Value = __Field;
@ -526,14 +528,7 @@ fn deserialize_field_visitor(
}
}
}
).unwrap(),
quote_item!(cx,
impl ::serde::de::Deserialize for __Field {
#[inline]
fn deserialize<S>(state: &mut S) -> Result<__Field, S::Error>
where S: ::serde::de::Deserializer,
{
state.visit(__FieldVisitor)
}
}