@@ -630,11 +630,7 @@ mod tests {
630
630
#[ bench]
631
631
pub fn bench_copy_nonarena ( b : & mut Bencher ) {
632
632
b. iter ( || {
633
- let _: Box < _ > = Box :: new ( Point {
634
- x : 1 ,
635
- y : 2 ,
636
- z : 3
637
- } ) ;
633
+ let _: Box < _ > = Box :: new ( Point { x : 1 , y : 2 , z : 3 } ) ;
638
634
} )
639
635
}
640
636
@@ -676,11 +672,7 @@ mod tests {
676
672
for _ in 0 ..100 {
677
673
arena. alloc ( || ( ) ) ;
678
674
}
679
- arena. alloc ( || Point {
680
- x : 1 ,
681
- y : 2 ,
682
- z : 3 ,
683
- } ) ;
675
+ arena. alloc ( || Point { x : 1 , y : 2 , z : 3 } ) ;
684
676
}
685
677
}
686
678
@@ -690,11 +682,7 @@ mod tests {
690
682
for _ in 0 ..10 {
691
683
arena. clear ( ) ;
692
684
for _ in 0 ..10000 {
693
- arena. alloc ( Point {
694
- x : 1 ,
695
- y : 2 ,
696
- z : 3 ,
697
- } ) ;
685
+ arena. alloc ( Point { x : 1 , y : 2 , z : 3 } ) ;
698
686
}
699
687
}
700
688
}
@@ -705,14 +693,12 @@ mod tests {
705
693
for _ in 0 ..10 {
706
694
arena. clear ( ) ;
707
695
for _ in 0 ..10000 {
708
- arena. alloc ( || Point {
709
- x : 1 ,
710
- y : 2 ,
711
- z : 3 ,
712
- } ) ;
713
- arena. alloc ( || Noncopy {
714
- string : "hello world" . to_string ( ) ,
715
- array : vec ! [ ] ,
696
+ arena. alloc ( || Point { x : 1 , y : 2 , z : 3 } ) ;
697
+ arena. alloc ( || {
698
+ Noncopy {
699
+ string : "hello world" . to_string ( ) ,
700
+ array : vec ! [ ] ,
701
+ }
716
702
} ) ;
717
703
}
718
704
}
@@ -722,11 +708,7 @@ mod tests {
722
708
pub fn test_arena_alloc_bytes ( ) {
723
709
let arena = Arena :: new ( ) ;
724
710
for i in 0 ..10000 {
725
- arena. alloc ( || Point {
726
- x : 1 ,
727
- y : 2 ,
728
- z : 3 ,
729
- } ) ;
711
+ arena. alloc ( || Point { x : 1 , y : 2 , z : 3 } ) ;
730
712
for byte in arena. alloc_bytes ( i % 42 ) . iter_mut ( ) {
731
713
* byte = i as u8 ;
732
714
}
@@ -754,10 +736,10 @@ mod tests {
754
736
for i in 0 ..10 {
755
737
// Arena allocate something with drop glue to make sure it
756
738
// doesn't leak.
757
- arena. alloc ( || { Rc :: new ( i) } ) ;
739
+ arena. alloc ( || Rc :: new ( i) ) ;
758
740
// Allocate something with funny size and alignment, to keep
759
741
// things interesting.
760
- arena. alloc ( || { [ 0u8 , 1 , 2 ] } ) ;
742
+ arena. alloc ( || [ 0u8 , 1 , 2 ] ) ;
761
743
}
762
744
// Now, panic while allocating
763
745
arena. alloc :: < Rc < i32 > , _ > ( || {
@@ -771,7 +753,7 @@ mod tests {
771
753
b. iter ( || {
772
754
arena. alloc ( Noncopy {
773
755
string : "hello world" . to_string ( ) ,
774
- array : vec ! ( 1 , 2 , 3 , 4 , 5 ) ,
756
+ array : vec ! [ 1 , 2 , 3 , 4 , 5 ] ,
775
757
} )
776
758
} )
777
759
}
@@ -781,7 +763,7 @@ mod tests {
781
763
b. iter ( || {
782
764
let _: Box < _ > = Box :: new ( Noncopy {
783
765
string : "hello world" . to_string ( ) ,
784
- array : vec ! ( 1 , 2 , 3 , 4 , 5 ) ,
766
+ array : vec ! [ 1 , 2 , 3 , 4 , 5 ] ,
785
767
} ) ;
786
768
} )
787
769
}
@@ -790,9 +772,11 @@ mod tests {
790
772
pub fn bench_noncopy_old_arena ( b : & mut Bencher ) {
791
773
let arena = Arena :: new ( ) ;
792
774
b. iter ( || {
793
- arena. alloc ( || Noncopy {
794
- string : "hello world" . to_string ( ) ,
795
- array : vec ! ( 1 , 2 , 3 , 4 , 5 ) ,
775
+ arena. alloc ( || {
776
+ Noncopy {
777
+ string : "hello world" . to_string ( ) ,
778
+ array : vec ! [ 1 , 2 , 3 , 4 , 5 ] ,
779
+ }
796
780
} )
797
781
} )
798
782
}
0 commit comments