File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
crates/bevy_ecs/macros/src Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -295,25 +295,26 @@ fn derive_system_param_impl(
295295 . collect :: < Vec < _ > > ( ) ;
296296 let field_members = fields. members ( ) . collect :: < Vec < _ > > ( ) ;
297297 let field_types = fields. iter ( ) . map ( |f| & f. ty ) . collect :: < Vec < _ > > ( ) ;
298-
299298 let field_names = fields
300299 . members ( )
301300 . map ( |m| format ! ( "::{}" , format_ident!( "{}" , m) ) ) ;
302301
303302 let mut field_messages = Vec :: new ( ) ;
304303 for attr in fields
305304 . iter ( )
306- . filter_map ( |f| f. attrs . iter ( ) . find ( |a| a. path ( ) . is_ident ( "system_param" ) ) )
307- {
305+ . map ( |f| f. attrs . iter ( ) . find ( |a| a. path ( ) . is_ident ( "system_param" ) ) )
306+ {
308307 let mut field_message = None ;
309- attr. parse_nested_meta ( |nested| {
310- if nested. path . is_ident ( "validation_message" ) {
311- field_message = Some ( nested. value ( ) ?. parse ( ) ?) ;
312- Ok ( ( ) )
313- } else {
314- Err ( nested. error ( "Unsupported attribute" ) )
315- }
316- } ) ?;
308+ if let Some ( attr) = attr {
309+ attr. parse_nested_meta ( |nested| {
310+ if nested. path . is_ident ( "validation_message" ) {
311+ field_message = Some ( nested. value ( ) ?. parse ( ) ?) ;
312+ Ok ( ( ) )
313+ } else {
314+ Err ( nested. error ( "Unsupported attribute" ) )
315+ }
316+ } ) ?;
317+ } ;
317318 field_messages. push ( field_message. unwrap_or_else ( || quote ! { err. message } ) ) ;
318319 }
319320
You can’t perform that action at this time.
0 commit comments