Skip to content

Commit 100a469

Browse files
committed
Ran rustfmt
1 parent 72a5bb7 commit 100a469

File tree

1 file changed

+19
-35
lines changed

1 file changed

+19
-35
lines changed

src/libarena/lib.rs

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,7 @@ mod tests {
630630
#[bench]
631631
pub fn bench_copy_nonarena(b: &mut Bencher) {
632632
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 });
638634
})
639635
}
640636

@@ -676,11 +672,7 @@ mod tests {
676672
for _ in 0..100 {
677673
arena.alloc(|| ());
678674
}
679-
arena.alloc(|| Point {
680-
x: 1,
681-
y: 2,
682-
z: 3,
683-
});
675+
arena.alloc(|| Point { x: 1, y: 2, z: 3 });
684676
}
685677
}
686678

@@ -690,11 +682,7 @@ mod tests {
690682
for _ in 0..10 {
691683
arena.clear();
692684
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 });
698686
}
699687
}
700688
}
@@ -705,14 +693,12 @@ mod tests {
705693
for _ in 0..10 {
706694
arena.clear();
707695
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+
}
716702
});
717703
}
718704
}
@@ -722,11 +708,7 @@ mod tests {
722708
pub fn test_arena_alloc_bytes() {
723709
let arena = Arena::new();
724710
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 });
730712
for byte in arena.alloc_bytes(i % 42).iter_mut() {
731713
*byte = i as u8;
732714
}
@@ -754,10 +736,10 @@ mod tests {
754736
for i in 0..10 {
755737
// Arena allocate something with drop glue to make sure it
756738
// doesn't leak.
757-
arena.alloc(|| { Rc::new(i) });
739+
arena.alloc(|| Rc::new(i));
758740
// Allocate something with funny size and alignment, to keep
759741
// things interesting.
760-
arena.alloc(|| { [0u8, 1, 2] });
742+
arena.alloc(|| [0u8, 1, 2]);
761743
}
762744
// Now, panic while allocating
763745
arena.alloc::<Rc<i32>, _>(|| {
@@ -771,7 +753,7 @@ mod tests {
771753
b.iter(|| {
772754
arena.alloc(Noncopy {
773755
string: "hello world".to_string(),
774-
array: vec!( 1, 2, 3, 4, 5 ),
756+
array: vec![1, 2, 3, 4, 5],
775757
})
776758
})
777759
}
@@ -781,7 +763,7 @@ mod tests {
781763
b.iter(|| {
782764
let _: Box<_> = Box::new(Noncopy {
783765
string: "hello world".to_string(),
784-
array: vec!( 1, 2, 3, 4, 5 ),
766+
array: vec![1, 2, 3, 4, 5],
785767
});
786768
})
787769
}
@@ -790,9 +772,11 @@ mod tests {
790772
pub fn bench_noncopy_old_arena(b: &mut Bencher) {
791773
let arena = Arena::new();
792774
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+
}
796780
})
797781
})
798782
}

0 commit comments

Comments
 (0)