@@ -41,8 +41,13 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
4141 attr. parse_args_with ( |input : ParseStream | {
4242 let meta = input. parse_terminated :: < syn:: Meta , syn:: token:: Comma > ( syn:: Meta :: parse) ?;
4343 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 {
4651 if let syn:: Meta :: Path ( _) = meta {
4752 fetch_struct_attributes. is_mutable = true ;
4853 } else {
@@ -51,7 +56,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
5156 MUTABLE_ATTRIBUTE_NAME
5257 ) ;
5358 }
54- } else if ident. map_or ( false , |ident| ident == DERIVE_ATTRIBUTE_NAME ) {
59+ } else if ident == DERIVE_ATTRIBUTE_NAME {
5560 if let syn:: Meta :: List ( meta_list) = meta {
5661 fetch_struct_attributes
5762 . derive_args
@@ -62,7 +67,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
6267 DERIVE_ATTRIBUTE_NAME
6368 ) ;
6469 }
65- } else if ident. map_or ( false , |ident| ident == FILTER_ATTRIBUTE_NAME ) {
70+ } else if ident == FILTER_ATTRIBUTE_NAME {
6671 if let syn:: Meta :: Path ( _) = meta {
6772 fetch_struct_attributes. is_filter = true ;
6873 } else {
@@ -180,6 +185,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
180185 }
181186 }
182187
188+ // We expect that only regular query declarations have a lifetime.
183189 if fetch_struct_attributes. is_filter {
184190 if has_world_lifetime {
185191 panic ! ( "Expected a struct without a lifetime" ) ;
@@ -479,12 +485,12 @@ fn read_world_query_field_info(
479485 let attrs = field
480486 . attrs
481487 . iter ( )
482- . cloned ( )
483488 . filter ( |attr| {
484489 attr. path
485490 . get_ident ( )
486491 . map_or ( true , |ident| ident != WORLD_QUERY_ATTRIBUTE_NAME )
487492 } )
493+ . cloned ( )
488494 . collect ( ) ;
489495
490496 let field_type = field. ty . clone ( ) ;
0 commit comments