@@ -439,11 +439,13 @@ fn test_node() {
439
439
name: KdlIdentifier {
440
440
value: "foo" . into( ) ,
441
441
repr: Some ( "foo" . into( ) ) ,
442
+ #[ cfg( feature = "span" ) ]
442
443
span: ( 0 ..3 ) . into( )
443
444
} ,
444
445
entries: vec![ ] ,
445
446
children: None ,
446
447
format: Some ( Default :: default ( ) ) ,
448
+ #[ cfg( feature = "span" ) ]
447
449
span: ( 0 ..7 ) . into( )
448
450
}
449
451
) ;
@@ -455,6 +457,7 @@ fn test_node() {
455
457
name: KdlIdentifier {
456
458
value: "foo" . into( ) ,
457
459
repr: Some ( "foo" . into( ) ) ,
460
+ #[ cfg( feature = "span" ) ]
458
461
span: ( 0 ..3 ) . into( )
459
462
} ,
460
463
entries: vec![ KdlEntry {
@@ -466,12 +469,14 @@ fn test_node() {
466
469
leading: " " . into( ) ,
467
470
..Default :: default ( )
468
471
} ) ,
472
+ #[ cfg( feature = "span" ) ]
469
473
span: SourceSpan :: new( 3 . into( ) , 4 )
470
474
} ] ,
471
475
children: None ,
472
476
format: Some ( KdlNodeFormat {
473
477
..Default :: default ( )
474
478
} ) ,
479
+ #[ cfg( feature = "span" ) ]
475
480
span: ( 0 ..8 ) . into( )
476
481
}
477
482
) ;
@@ -552,7 +557,6 @@ fn node_entry(input: &mut Input<'_>) -> PResult<Option<KdlEntry>> {
552
557
fmt. after_key = after_key. into ( ) ;
553
558
fmt. after_eq = after_eq. into ( ) ;
554
559
}
555
- #[ cfg( feature = "span" ) ]
556
560
value
557
561
} )
558
562
} else if let Some ( ident) = maybe_ident {
@@ -607,6 +611,7 @@ fn entry_test() {
607
611
value_repr: "bar" . into( ) ,
608
612
..Default :: default ( )
609
613
} ) ,
614
+ #[ cfg( feature = "span" ) ]
610
615
span: ( 0 ..7 ) . into( )
611
616
} )
612
617
) ;
@@ -621,6 +626,7 @@ fn entry_test() {
621
626
value_repr: "foo" . into( ) ,
622
627
..Default :: default ( )
623
628
} ) ,
629
+ #[ cfg( feature = "span" ) ]
624
630
span: ( 0 ..3 ) . into( )
625
631
} )
626
632
) ;
@@ -636,6 +642,7 @@ fn entry_test() {
636
642
leading: "/-foo " . into( ) ,
637
643
..Default :: default ( )
638
644
} ) ,
645
+ #[ cfg( feature = "span" ) ]
639
646
span: ( 6 ..9 ) . into( )
640
647
} )
641
648
) ;
@@ -648,6 +655,7 @@ fn entry_test() {
648
655
name: Some ( KdlIdentifier {
649
656
value: "bar" . into( ) ,
650
657
repr: Some ( "bar" . into( ) ) ,
658
+ #[ cfg( feature = "span" ) ]
651
659
span: ( 9 ..12 ) . into( ) ,
652
660
} ) ,
653
661
format: Some ( KdlEntryFormat {
@@ -657,6 +665,7 @@ fn entry_test() {
657
665
after_eq: " " . into( ) ,
658
666
..Default :: default ( )
659
667
} ) ,
668
+ #[ cfg( feature = "span" ) ]
660
669
span: ( 9 ..16 ) . into( )
661
670
} )
662
671
) ;
@@ -669,6 +678,7 @@ fn entry_test() {
669
678
name: Some ( KdlIdentifier {
670
679
value: "bar" . into( ) ,
671
680
repr: Some ( "bar" . into( ) ) ,
681
+ #[ cfg( feature = "span" ) ]
672
682
span: ( 12 ..16 ) . into( ) ,
673
683
} ) ,
674
684
format: Some ( KdlEntryFormat {
@@ -678,6 +688,7 @@ fn entry_test() {
678
688
after_eq: " " . into( ) ,
679
689
..Default :: default ( )
680
690
} ) ,
691
+ #[ cfg( feature = "span" ) ]
681
692
span: ( 12 ..18 ) . into( )
682
693
} )
683
694
) ;
@@ -749,10 +760,7 @@ fn node_children(input: &mut Input<'_>) -> PResult<KdlDocument> {
749
760
. or_else ( |mut e : ErrMode < KdlParseError > | {
750
761
e = match e {
751
762
ErrMode :: Cut ( mut pe) => {
752
- #[ cfg( feature = "span" ) ]
753
- {
754
- pe. span = Some ( ( _before_open_loc.._after_open_loc) . into ( ) ) ;
755
- }
763
+ pe. span = Some ( ( _before_open_loc.._after_open_loc) . into ( ) ) ;
756
764
ErrMode :: Cut ( pe)
757
765
}
758
766
e => return Err ( e) ,
@@ -1508,6 +1516,7 @@ mod string_tests {
1508
1516
KdlIdentifier {
1509
1517
value: "foo" . into( ) ,
1510
1518
repr: Some ( "foo" . into( ) ) ,
1519
+ #[ cfg( feature = "span" ) ]
1511
1520
span: ( 0 ..3 ) . into( )
1512
1521
}
1513
1522
) ;
@@ -1516,6 +1525,7 @@ mod string_tests {
1516
1525
KdlIdentifier {
1517
1526
value: "+." . into( ) ,
1518
1527
repr: Some ( "+." . into( ) ) ,
1528
+ #[ cfg( feature = "span" ) ]
1519
1529
span: ( 0 ..1 ) . into( )
1520
1530
}
1521
1531
)
0 commit comments