Skip to content

Commit

Permalink
run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-deason committed May 21, 2019
1 parent 745bcf0 commit 7481c44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 13 additions & 4 deletions amethyst_derive/src/prefab_data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use proc_macro2::{Literal, TokenStream};
use quote::quote;
use syn::{
Attribute, Data, DataEnum, DataStruct, DeriveInput, Fields, Generics, Meta, NestedMeta, Type, Ident
Attribute, Data, DataEnum, DataStruct, DeriveInput, Fields, Generics, Ident, Meta, NestedMeta,
Type,
};

pub fn impl_prefab_data(ast: &DeriveInput) -> TokenStream {
Expand Down Expand Up @@ -43,7 +44,10 @@ fn prepare_prefab_aggregate_fields(
let mut add_to_entity = Vec::new();
for field in fields.iter() {
let is_component = have_component_attribute(&field.attrs[..]);
let i = match data_types.iter().position(|t| t.0 == field.ty && t.1 == is_component) {
let i = match data_types
.iter()
.position(|t| t.0 == field.ty && t.1 == is_component)
{
Some(i) => i,
None => {
data_types.push((field.ty.clone(), is_component));
Expand Down Expand Up @@ -75,7 +79,9 @@ fn prepare_prefab_aggregate_fields(
(add_to_entity, subs)
}

fn prepare_prefab_aggregate_struct(data: &DataStruct) -> (Vec<(Type, bool)>, TokenStream, TokenStream) {
fn prepare_prefab_aggregate_struct(
data: &DataStruct,
) -> (Vec<(Type, bool)>, TokenStream, TokenStream) {
let mut data_types = Vec::new();
let (add_to_entity, subs) = prepare_prefab_aggregate_fields(&mut data_types, &data.fields);
let extract_fields_add = data.fields.iter().map(|f| {
Expand Down Expand Up @@ -103,7 +109,10 @@ fn prepare_prefab_aggregate_struct(data: &DataStruct) -> (Vec<(Type, bool)>, Tok
)
}

fn prepare_prefab_aggregate_enum(base: &Ident, data: &DataEnum) -> (Vec<(Type, bool)>, TokenStream, TokenStream) {
fn prepare_prefab_aggregate_enum(
base: &Ident,
data: &DataEnum,
) -> (Vec<(Type, bool)>, TokenStream, TokenStream) {
let mut data_types = Vec::new();
let mut subs = Vec::new();
let mut add_to_entity = Vec::new();
Expand Down
3 changes: 1 addition & 2 deletions amethyst_derive/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,5 @@ pub enum EnumPrefab {
#[prefab(Component)]
component: External,
},
Three {
},
Three {},
}

0 comments on commit 7481c44

Please sign in to comment.