@@ -43,9 +43,9 @@ enum FromQueryMethod {
43
43
44
44
#[ derive( Debug , Clone , Copy ) ]
45
45
enum AppendQueryMethod {
46
- AppendValue ,
47
- AppendOption ,
48
- AppendVec ,
46
+ Value ,
47
+ Option ,
48
+ Vec ,
49
49
}
50
50
51
51
impl ParsedParamsStruct {
@@ -308,23 +308,23 @@ impl ParsedParamsStruct {
308
308
309
309
// Otherwise use auto-detection
310
310
match field. detect_append_query_method ( ) {
311
- AppendQueryMethod :: AppendOption => {
311
+ AppendQueryMethod :: Option => {
312
312
quote ! {
313
313
append_option_query_value_pair(
314
314
#enum_name:: #variant_name,
315
315
self . #field_ident. as_ref( )
316
316
)
317
317
}
318
318
}
319
- AppendQueryMethod :: AppendVec => {
319
+ AppendQueryMethod :: Vec => {
320
320
quote ! {
321
321
append_vec_query_value_pair(
322
322
#enum_name:: #variant_name,
323
323
& self . #field_ident
324
324
)
325
325
}
326
326
}
327
- AppendQueryMethod :: AppendValue => {
327
+ AppendQueryMethod :: Value => {
328
328
quote ! {
329
329
append_query_value_pair(
330
330
#enum_name:: #variant_name,
@@ -429,29 +429,26 @@ impl ParsedField {
429
429
syn:: Type :: Path ( type_path) => {
430
430
if let Some ( last_segment) = type_path. path . segments . last ( ) {
431
431
match last_segment. ident . to_string ( ) . as_str ( ) {
432
- "Option" => AppendQueryMethod :: AppendOption ,
433
- "Vec" => AppendQueryMethod :: AppendVec ,
434
- _ => AppendQueryMethod :: AppendValue , // fallback for non-generic types
432
+ "Option" => AppendQueryMethod :: Option ,
433
+ "Vec" => AppendQueryMethod :: Vec ,
434
+ _ => AppendQueryMethod :: Value , // fallback for non-generic types
435
435
}
436
436
} else {
437
- AppendQueryMethod :: AppendValue
437
+ AppendQueryMethod :: Value
438
438
}
439
439
}
440
- _ => AppendQueryMethod :: AppendValue , // fallback for other types
440
+ _ => AppendQueryMethod :: Value , // fallback for other types
441
441
}
442
442
}
443
443
444
444
/// Check if this field is Option<WpGmtDateTime>
445
445
fn is_wp_date_time_option ( & self , option_segment : & syn:: PathSegment ) -> bool {
446
446
// Check if Option has generic arguments
447
- if let syn:: PathArguments :: AngleBracketed ( ref args) = option_segment. arguments {
448
- if let Some ( syn:: GenericArgument :: Type ( inner_type) ) = args. args . first ( ) {
449
- if let syn:: Type :: Path ( inner_path) = inner_type {
450
- if let Some ( last_segment) = inner_path. path . segments . last ( ) {
451
- return last_segment. ident == "WpGmtDateTime" ;
452
- }
453
- }
454
- }
447
+ if let syn:: PathArguments :: AngleBracketed ( ref args) = option_segment. arguments
448
+ && let Some ( syn:: GenericArgument :: Type ( syn:: Type :: Path ( inner_path) ) ) = args. args . first ( )
449
+ && let Some ( last_segment) = inner_path. path . segments . last ( )
450
+ {
451
+ return last_segment. ident == "WpGmtDateTime" ;
455
452
}
456
453
false
457
454
}
@@ -509,7 +506,7 @@ mod tests {
509
506
) ) ;
510
507
assert ! ( matches!(
511
508
field. detect_append_query_method( ) ,
512
- AppendQueryMethod :: AppendOption
509
+ AppendQueryMethod :: Option
513
510
) ) ;
514
511
}
515
512
@@ -530,7 +527,7 @@ mod tests {
530
527
) ) ;
531
528
assert ! ( matches!(
532
529
field. detect_append_query_method( ) ,
533
- AppendQueryMethod :: AppendVec
530
+ AppendQueryMethod :: Vec
534
531
) ) ;
535
532
}
536
533
@@ -551,7 +548,7 @@ mod tests {
551
548
) ) ;
552
549
assert ! ( matches!(
553
550
field. detect_append_query_method( ) ,
554
- AppendQueryMethod :: AppendOption
551
+ AppendQueryMethod :: Option
555
552
) ) ;
556
553
}
557
554
@@ -572,7 +569,7 @@ mod tests {
572
569
) ) ;
573
570
assert ! ( matches!(
574
571
field. detect_append_query_method( ) ,
575
- AppendQueryMethod :: AppendValue
572
+ AppendQueryMethod :: Value
576
573
) ) ;
577
574
}
578
575
}
0 commit comments