From c4736336768a6a3ac82f909a311bd9512ab49589 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 4 Feb 2019 00:39:32 +0100 Subject: [PATCH] Format with rustfmt 2018-12-10 --- serde_derive/src/ser.rs | 9 +++------ test_suite/tests/test_macros.rs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/serde_derive/src/ser.rs b/serde_derive/src/ser.rs index e87ddee80..4d1f680db 100644 --- a/serde_derive/src/ser.rs +++ b/serde_derive/src/ser.rs @@ -289,10 +289,7 @@ fn serialize_struct(params: &Parameters, fields: &[Field], cattrs: &attr::Contai } } -fn serialize_struct_tag_field( - cattrs: &attr::Container, - struct_trait: &StructTrait, -) -> TokenStream { +fn serialize_struct_tag_field(cattrs: &attr::Container, struct_trait: &StructTrait) -> TokenStream { match *cattrs.tag() { attr::TagType::Internal { ref tag } => { let type_name = cattrs.name().serialize_name(); @@ -301,7 +298,7 @@ fn serialize_struct_tag_field( try!(#func(&mut __serde_state, #tag, #type_name)); } } - _ => quote!{} + _ => quote! {}, } } @@ -377,7 +374,7 @@ fn serialize_struct_as_map( }) .fold( quote!(#tag_field_exists as usize), - |sum, expr| quote!(#sum + #expr) + |sum, expr| quote!(#sum + #expr), ); quote!(_serde::export::Some(#len)) }; diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs index dd9591370..e474953ad 100644 --- a/test_suite/tests/test_macros.rs +++ b/test_suite/tests/test_macros.rs @@ -1427,20 +1427,20 @@ fn test_internally_tagged_braced_struct_with_zero_fields() { #[test] fn test_internally_tagged_struct_with_flattened_field() { #[derive(Debug, PartialEq, Serialize, Deserialize)] - #[serde(tag="tag_struct")] + #[serde(tag = "tag_struct")] pub struct Struct { #[serde(flatten)] - pub flat: Enum + pub flat: Enum, } #[derive(Debug, PartialEq, Serialize, Deserialize)] - #[serde(tag="tag_enum", content="content")] + #[serde(tag = "tag_enum", content = "content")] pub enum Enum { A(u64), } assert_tokens( - &Struct{flat: Enum::A(0)}, + &Struct { flat: Enum::A(0) }, &[ Token::Map { len: None }, Token::Str("tag_struct"), @@ -1449,20 +1449,20 @@ fn test_internally_tagged_struct_with_flattened_field() { Token::Str("A"), Token::Str("content"), Token::U64(0), - Token::MapEnd - ] + Token::MapEnd, + ], ); assert_de_tokens( - &Struct{flat: Enum::A(0)}, + &Struct { flat: Enum::A(0) }, &[ Token::Map { len: None }, Token::Str("tag_enum"), Token::Str("A"), Token::Str("content"), Token::U64(0), - Token::MapEnd - ] + Token::MapEnd, + ], ); }