Skip to content

Commit

Permalink
former : refactor attributes parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Wandalen committed May 19, 2024
1 parent 60e396f commit 1f4dfee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
1 change: 0 additions & 1 deletion module/core/former_meta/src/derive_former/field_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct FieldAttributes

impl FieldAttributes
{
// fn from_attrs( attributes : & Vec< syn::Attribute > ) -> Result< Self >
pub fn from_attrs< 'a >( attrs : impl Iterator< Item = &'a syn::Attribute > ) -> Result< Self >
{
let mut config = None;
Expand Down
26 changes: 1 addition & 25 deletions module/core/former_meta/src/derive_former/struct_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl StructAttributes
continue;
}

// qqq : qqq for Anton : xxx : refactor field_attrs::FieldAttributes::from_attrs to make it similar to this function
match key_str.as_ref()
{
AttributeStorageFields::KEYWORD =>
Expand Down Expand Up @@ -214,7 +215,6 @@ impl AttributeMutator

pub fn from_meta( attr : &syn::Attribute ) -> Result< Self >
{

match attr.meta
{
syn::Meta::List( ref meta_list ) =>
Expand All @@ -227,16 +227,6 @@ impl AttributeMutator
},
_ => return_syn_err!( attr, "Expects an attribute of format `#[ mutator( custom = true, hint = true ) ]`. \nGot: {}", qt!{ #attr } ),
}

// match attr.meta
// {
// syn::Meta::List( ref meta_list ) =>
// {
// return syn::parse2::< AttributeStorageFields >( meta_list.tokens.clone() );
// },
// _ => return_syn_err!( attr, "Expects an attribute of format #[ storage_fields( a : i32, b : Option< String > ) ]
// .\nGot: {}", qt!{ #attr } ),
// }
}

}
Expand Down Expand Up @@ -297,10 +287,6 @@ impl syn::parse::Parse for AttributeMutator
/// `#[ perform( fn after1< 'a >() -> Option< &'a str > ) ]`
///

// storage_fields
// perform
// mutator

pub struct AttributePerform
{
pub signature : syn::Signature,
Expand All @@ -322,16 +308,6 @@ impl AttributePerform
_ => return_syn_err!( attr, "Expects an attribute of format #[ perform( fn parse( mut self ) -> Request ) ]
.\nGot: {}", qt!{ #attr } ),
}

// match attr.meta
// {
// syn::Meta::List( ref meta_list ) =>
// {
// return syn::parse2::< AttributeStorageFields >( meta_list.tokens.clone() );
// },
// _ => return_syn_err!( attr, "Expects an attribute of format #[ storage_fields( a : i32, b : Option< String > ) ]
// .\nGot: {}", qt!{ #attr } ),
// }
}

}
Expand Down

0 comments on commit 1f4dfee

Please sign in to comment.