Skip to content

Commit 61b4780

Browse files
Apply suggestions from code review
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
1 parent 9fbb8a7 commit 61b4780

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/bevy_ecs/macros/src/fetch.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ 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().expect(format!("Unrecognized attribute: `{}`", meta.path().to_token_stream()));
45+
if ident == MUTABLE_ATTRIBUTE_NAME {
4646
if let syn::Meta::Path(_) = meta {
4747
fetch_struct_attributes.is_mutable = true;
4848
} else {
@@ -51,7 +51,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
5151
MUTABLE_ATTRIBUTE_NAME
5252
);
5353
}
54-
} else if ident.map_or(false, |ident| ident == DERIVE_ATTRIBUTE_NAME) {
54+
} else if ident == DERIVE_ATTRIBUTE_NAME {
5555
if let syn::Meta::List(meta_list) = meta {
5656
fetch_struct_attributes
5757
.derive_args
@@ -62,7 +62,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
6262
DERIVE_ATTRIBUTE_NAME
6363
);
6464
}
65-
} else if ident.map_or(false, |ident| ident == FILTER_ATTRIBUTE_NAME) {
65+
} else if ident == FILTER_ATTRIBUTE_NAME {
6666
if let syn::Meta::Path(_) = meta {
6767
fetch_struct_attributes.is_filter = true;
6868
} else {
@@ -479,12 +479,12 @@ fn read_world_query_field_info(
479479
let attrs = field
480480
.attrs
481481
.iter()
482-
.cloned()
483482
.filter(|attr| {
484483
attr.path
485484
.get_ident()
486485
.map_or(true, |ident| ident != WORLD_QUERY_ATTRIBUTE_NAME)
487486
})
487+
.cloned()
488488
.collect();
489489

490490
let field_type = field.ty.clone();

0 commit comments

Comments
 (0)