@@ -41,8 +41,13 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
41
41
attr. parse_args_with ( |input : ParseStream | {
42
42
let meta = input. parse_terminated :: < syn:: Meta , syn:: token:: Comma > ( syn:: Meta :: parse) ?;
43
43
for meta in meta {
44
- let ident = meta. path ( ) . get_ident ( ) ;
45
- if ident. map_or ( false , |ident| ident == MUTABLE_ATTRIBUTE_NAME ) {
44
+ let ident = meta. path ( ) . get_ident ( ) . unwrap_or_else ( || {
45
+ panic ! (
46
+ "Unrecognized attribute: `{}`" ,
47
+ meta. path( ) . to_token_stream( )
48
+ )
49
+ } ) ;
50
+ if ident == MUTABLE_ATTRIBUTE_NAME {
46
51
if let syn:: Meta :: Path ( _) = meta {
47
52
fetch_struct_attributes. is_mutable = true ;
48
53
} else {
@@ -51,7 +56,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
51
56
MUTABLE_ATTRIBUTE_NAME
52
57
) ;
53
58
}
54
- } else if ident. map_or ( false , |ident| ident == DERIVE_ATTRIBUTE_NAME ) {
59
+ } else if ident == DERIVE_ATTRIBUTE_NAME {
55
60
if let syn:: Meta :: List ( meta_list) = meta {
56
61
fetch_struct_attributes
57
62
. derive_args
@@ -62,7 +67,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
62
67
DERIVE_ATTRIBUTE_NAME
63
68
) ;
64
69
}
65
- } else if ident. map_or ( false , |ident| ident == FILTER_ATTRIBUTE_NAME ) {
70
+ } else if ident == FILTER_ATTRIBUTE_NAME {
66
71
if let syn:: Meta :: Path ( _) = meta {
67
72
fetch_struct_attributes. is_filter = true ;
68
73
} else {
@@ -180,6 +185,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
180
185
}
181
186
}
182
187
188
+ // We expect that only regular query declarations have a lifetime.
183
189
if fetch_struct_attributes. is_filter {
184
190
if has_world_lifetime {
185
191
panic ! ( "Expected a struct without a lifetime" ) ;
@@ -479,12 +485,12 @@ fn read_world_query_field_info(
479
485
let attrs = field
480
486
. attrs
481
487
. iter ( )
482
- . cloned ( )
483
488
. filter ( |attr| {
484
489
attr. path
485
490
. get_ident ( )
486
491
. map_or ( true , |ident| ident != WORLD_QUERY_ATTRIBUTE_NAME )
487
492
} )
493
+ . cloned ( )
488
494
. collect ( ) ;
489
495
490
496
let field_type = field. ty . clone ( ) ;
0 commit comments