From da641b1b3c89bc6dd1c92bcd2c6242bdb88cb6bc Mon Sep 17 00:00:00 2001 From: Mingun Date: Thu, 10 Mar 2022 21:18:41 +0500 Subject: [PATCH] run `cargo fmt` --- serde_derive/src/de.rs | 48 +++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index 16aa8734b..895033063 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -1002,7 +1002,13 @@ fn deserialize_struct_visitor( }; let field_visitor = Stmts(field_visitor); let fields_stmt = fields_stmt.map(Stmts); - let visit_map = Stmts(deserialize_map(field_struct_name(prefix), &type_path, params, fields, cattrs)); + let visit_map = Stmts(deserialize_map( + field_struct_name(prefix), + &type_path, + params, + fields, + cattrs, + )); let visitor_name = visitor_struct_name(prefix); @@ -1239,7 +1245,9 @@ fn deserialize_enum( cattrs: &attr::Container, ) -> Fragment { match cattrs.tag() { - attr::TagType::External => deserialize_externally_tagged_enum(prefix, params, variants, cattrs), + attr::TagType::External => { + deserialize_externally_tagged_enum(prefix, params, variants, cattrs) + } attr::TagType::Internal { tag } => { deserialize_internally_tagged_enum(prefix, params, variants, cattrs, tag) } @@ -1419,22 +1427,21 @@ fn deserialize_internally_tagged_enum( _ => None, } }); - let variant_arms = variants - .map(|(i, variant)| { - let variant_name = field_i(i); + let variant_arms = variants.map(|(i, variant)| { + let variant_name = field_i(i); - let block = Match(deserialize_internally_tagged_variant( - &format!("Variant{}", i), - params, - variant, - cattrs, - quote!(__deserializer), - )); + let block = Match(deserialize_internally_tagged_variant( + &format!("Variant{}", i), + params, + variant, + cattrs, + quote!(__deserializer), + )); - quote! { - #field_struct_name::#variant_name => #block - } - }); + quote! { + #field_struct_name::#variant_name => #block + } + }); let expecting = format!("internally tagged enum {}", params.type_name()); let expecting = cattrs.expecting().unwrap_or(&expecting); @@ -2575,7 +2582,8 @@ fn deserialize_struct_as_struct_visitor( } }; - let field_visitor = deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); + let field_visitor = + deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); (field_visitor, Some(fields_stmt)) } @@ -2598,7 +2606,8 @@ fn deserialize_struct_as_map_visitor( }) .collect(); - let field_visitor = deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); + let field_visitor = + deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); (field_visitor, None) } @@ -2849,7 +2858,8 @@ fn deserialize_struct_as_struct_in_place_visitor( } }; - let field_visitor = deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); + let field_visitor = + deserialize_generated_identifier(prefix, &field_names_idents, cattrs, false, None); let visit_map = deserialize_map_in_place(field_struct_name(prefix), params, fields, cattrs);