@@ -4,6 +4,7 @@ use syn::{
4
4
} ;
5
5
6
6
use crate :: utils;
7
+ use crate :: utils:: isblank;
7
8
8
9
pub type MapTuple = ( String , bool ) ;
9
10
#[ derive( Debug , Default ) ]
@@ -239,6 +240,17 @@ impl MapperEntry {
239
240
}
240
241
241
242
fn parse_macro_attr_attribute ( mapper_entry : & mut MapperEntry , expr_arr : & ExprArray ) {
243
+ if mapper_entry
244
+ . macro_attr
245
+ . iter ( )
246
+ . find ( |attr| isblank ( attr) )
247
+ . is_some ( )
248
+ {
249
+ panic ! (
250
+ "`{}` attribute must not be empty. Remove it if it's not needed. {:?}" ,
251
+ MACRO_ATTR , mapper_entry. macro_attr
252
+ ) ;
253
+ }
242
254
mapper_entry. macro_attr = Self :: parse_array_of_macro_attr ( expr_arr) ;
243
255
//println!("{:?}",mapper_entry.new_fields);
244
256
}
@@ -365,16 +377,17 @@ impl MapperEntry {
365
377
if let Some ( colon_position) = field_decl. find ( ":" ) {
366
378
// eprintln!("field_decl={}", field_decl);
367
379
// eprintln!("colon={}", colon_position);
380
+ let new_field_attr = match attributes. is_empty ( ) {
381
+ true => None ,
382
+ false => Some ( attributes. clone ( ) ) ,
383
+ } ;
384
+
368
385
Self :: insert_next_field_value (
369
386
& mut vec_tuple,
370
387
field_value. clone ( ) ,
371
388
field_decl,
372
389
& colon_position,
373
- if attributes. is_empty ( ) {
374
- None
375
- } else {
376
- Some ( attributes. clone ( ) )
377
- } ,
390
+ new_field_attr,
378
391
) ;
379
392
} else {
380
393
panic ! ( "Missing `:` character for field declaration" ) ;
0 commit comments