From ecb7909ca7bf48a2a61646a0b9c119d6ae6cbfab Mon Sep 17 00:00:00 2001 From: Sebastiano Vigna Date: Mon, 6 Nov 2023 12:03:36 +0100 Subject: [PATCH] Fixed spacing --- epserde-derive/src/lib.rs | 64 +++++++++++------------------------ epserde/src/impls/mod.rs | 2 +- epserde/tests/test_phantom.rs | 2 +- 3 files changed, 22 insertions(+), 46 deletions(-) diff --git a/epserde-derive/src/lib.rs b/epserde-derive/src/lib.rs index ec10139..341145d 100644 --- a/epserde-derive/src/lib.rs +++ b/epserde-derive/src/lib.rs @@ -170,33 +170,19 @@ pub fn epserde_derive(input: TokenStream) -> TokenStream { generics_name_vec, generics, .. - } = CommonDeriveInput::new(derive_input.clone(), - vec![], - ); + } = CommonDeriveInput::new(derive_input.clone(), vec![]); // Values for serialize (we add serialization bounds to generics) let CommonDeriveInput { generics: generics_serialize, .. - } = CommonDeriveInput::new( - derive_input.clone(), - vec![ - //syn::parse_quote!(epserde::prelude::TypeHash), - //syn::parse_quote!(epserde::prelude::ReprHash) - ], - ); + } = CommonDeriveInput::new(derive_input.clone(), vec![]); // Values for deserialize (we add deserialization bounds to generics) let CommonDeriveInput { generics: generics_deserialize, .. - } = CommonDeriveInput::new( - derive_input.clone(), - vec![ - //syn::parse_quote!(epserde::prelude::TypeHash), - //syn::parse_quote!(epserde::prelude::ReprHash) - ], - ); + } = CommonDeriveInput::new(derive_input.clone(), vec![]); let out = match derive_input.data { Data::Struct(s) => { @@ -266,30 +252,26 @@ pub fn epserde_derive(input: TokenStream) -> TokenStream { fields_types.iter().for_each(|ty| { // add that every struct field has to implement SerializeInner let mut bounds_ser = Punctuated::new(); - bounds_ser.push( - syn::parse_quote!(epserde::ser::SerializeInner) - ); - where_clause_ser.predicates.push( - WherePredicate::Type(PredicateType { - lifetimes: None, - bounded_ty: (*ty).clone(), + bounds_ser.push(syn::parse_quote!(epserde::ser::SerializeInner)); + where_clause_ser + .predicates + .push(WherePredicate::Type(PredicateType { + lifetimes: None, + bounded_ty: (*ty).clone(), colon_token: token::Colon::default(), bounds: bounds_ser, - }) - ); + })); // add that every struct field has to implement DeserializeInner let mut bounds_des = Punctuated::new(); - bounds_des.push( - syn::parse_quote!(epserde::deser::DeserializeInner) - ); - where_clause_des.predicates.push( - WherePredicate::Type(PredicateType { - lifetimes: None, - bounded_ty: (*ty).clone(), + bounds_des.push(syn::parse_quote!(epserde::deser::DeserializeInner)); + where_clause_des + .predicates + .push(WherePredicate::Type(PredicateType { + lifetimes: None, + bounded_ty: (*ty).clone(), colon_token: token::Colon::default(), bounds: bounds_des, - }) - ); + })); }); // We add to the deserialization where clause the bounds on the deserialization @@ -466,9 +448,7 @@ pub fn epserde_type_hash(input: TokenStream) -> TokenStream { .. } = CommonDeriveInput::new( input.clone(), - vec![ - syn::parse_quote!(epserde::traits::TypeHash), - ], + vec![syn::parse_quote!(epserde::traits::TypeHash)], ); let CommonDeriveInput { @@ -476,9 +456,7 @@ pub fn epserde_type_hash(input: TokenStream) -> TokenStream { .. } = CommonDeriveInput::new( input.clone(), - vec![ - syn::parse_quote!(epserde::traits::ReprHash), - ], + vec![syn::parse_quote!(epserde::traits::ReprHash)], ); let CommonDeriveInput { @@ -486,9 +464,7 @@ pub fn epserde_type_hash(input: TokenStream) -> TokenStream { .. } = CommonDeriveInput::new( input.clone(), - vec![ - syn::parse_quote!(epserde::traits::MaxSizeOf), - ], + vec![syn::parse_quote!(epserde::traits::MaxSizeOf)], ); let out = match input.data { diff --git a/epserde/src/impls/mod.rs b/epserde/src/impls/mod.rs index 1d9605e..1ebdb08 100644 --- a/epserde/src/impls/mod.rs +++ b/epserde/src/impls/mod.rs @@ -18,5 +18,5 @@ pub mod prim; pub mod slice; pub mod string; pub mod tuple; -#[cfg(any(feature="alloc", feature="std"))] +#[cfg(any(feature = "alloc", feature = "std"))] pub mod vec; diff --git a/epserde/tests/test_phantom.rs b/epserde/tests/test_phantom.rs index 2bf44a6..635951b 100644 --- a/epserde/tests/test_phantom.rs +++ b/epserde/tests/test_phantom.rs @@ -1,8 +1,8 @@ #![cfg(test)] +use core::marker::PhantomData; use epserde::prelude::*; use epserde::TypeInfo; -use core::marker::PhantomData; #[test] /// Test that we can serialize and desertialize a PhantomData