diff options
Diffstat (limited to 'azalea-block')
| -rwxr-xr-x | azalea-block/azalea-block-macros/src/lib.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/azalea-block/azalea-block-macros/src/lib.rs b/azalea-block/azalea-block-macros/src/lib.rs index 8b26122c..bbd98619 100755 --- a/azalea-block/azalea-block-macros/src/lib.rs +++ b/azalea-block/azalea-block-macros/src/lib.rs @@ -73,7 +73,7 @@ impl Parse for PropertyWithNameAndDefault { is_enum = true; property_type = first_ident; let variant = input.parse::<Ident>()?; - property_default.extend(quote! { ::#variant }) + property_default.extend(quote! { ::#variant }); } else if first_ident_string == "true" || first_ident_string == "false" { property_type = Ident::new("bool", first_ident.span()); } else { @@ -388,7 +388,7 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { // Ident::new(&property.to_string(), proc_macro2::Span::call_site()); block_struct_fields.extend(quote! { pub #name: #struct_name, - }) + }); } let block_name_pascal_case = Ident::new( @@ -420,8 +420,7 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { combination .iter() .map(|v| v[0..1].to_uppercase() + &v[1..]) - .collect::<Vec<String>>() - .join("") + .collect::<String>() ), proc_macro2::Span::call_site(), ); @@ -509,20 +508,20 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { .. } in properties_with_name { - block_default_fields.extend(quote! {#name: #property_default,}) + block_default_fields.extend(quote! { #name: #property_default, }); } let block_behavior = &block.behavior; let block_id = block.name.to_string(); - let from_block_to_state_match = if !block.properties_and_defaults.is_empty() { + let from_block_to_state_match = if block.properties_and_defaults.is_empty() { + quote! { BlockState::#block_name_pascal_case } + } else { quote! { match b { #from_block_to_state_match_inner } } - } else { - quote! { BlockState::#block_name_pascal_case } }; let block_struct = quote! { |
