From dff919a9262f45465cf6e433a7445bbd4a0d6a47 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 20 Feb 2017 14:16:54 -0800 Subject: [PATCH] Rename __simple_value to __field0 to be consistent with tuples --- serde_derive/src/ser.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/serde_derive/src/ser.rs b/serde_derive/src/ser.rs index 95708b2a..1f1ac863 100644 --- a/serde_derive/src/ser.rs +++ b/serde_derive/src/ser.rs @@ -226,7 +226,7 @@ fn serialize_variant(ident: &syn::Ident, } Style::Newtype => { quote! { - #ident::#variant_ident(ref __simple_value) + #ident::#variant_ident(ref __field0) } } Style::Tuple => { @@ -300,7 +300,7 @@ fn serialize_externally_tagged_variant(ident: &syn::Ident, } Style::Newtype => { let field = &variant.fields[0]; - let mut field_expr = quote!(__simple_value); + let mut field_expr = quote!(__field0); if let Some(path) = field.attrs.serialize_with() { field_expr = wrap_serialize_with(ident, generics, field.ty, path, field_expr); } @@ -370,7 +370,7 @@ fn serialize_internally_tagged_variant(ident: &syn::Ident, } Style::Newtype => { let field = &variant.fields[0]; - let mut field_expr = quote!(__simple_value); + let mut field_expr = quote!(__field0); if let Some(path) = field.attrs.serialize_with() { field_expr = wrap_serialize_with(ident, generics, field.ty, path, field_expr); } @@ -426,7 +426,7 @@ fn serialize_adjacently_tagged_variant(ident: &syn::Ident, } Style::Newtype => { let field = &variant.fields[0]; - let mut field_expr = quote!(__simple_value); + let mut field_expr = quote!(__field0); if let Some(path) = field.attrs.serialize_with() { field_expr = wrap_serialize_with(ident, generics, field.ty, path, field_expr); } @@ -453,7 +453,7 @@ fn serialize_adjacently_tagged_variant(ident: &syn::Ident, let fields_ty = variant.fields.iter().map(|f| &f.ty); let ref fields_ident: Vec<_> = match variant.style { Style::Unit => unreachable!(), - Style::Newtype => vec![Ident::new("__simple_value")], + Style::Newtype => vec![Ident::new("__field0")], Style::Tuple => { (0..variant.fields.len()) .map(|i| Ident::new(format!("__field{}", i))) @@ -513,7 +513,7 @@ fn serialize_untagged_variant(ident: &syn::Ident, } Style::Newtype => { let field = &variant.fields[0]; - let mut field_expr = quote!(__simple_value); + let mut field_expr = quote!(__field0); if let Some(path) = field.attrs.serialize_with() { field_expr = wrap_serialize_with(ident, generics, field.ty, path, field_expr); }