Skip to content

Commit bf3d40a

Browse files
committed
Update TypedArena tests
1 parent 54eb222 commit bf3d40a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/libarena/lib.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ mod tests {
500500

501501
#[test]
502502
pub fn test_unused() {
503-
let arena: TypedArena<Point> = TypedArena::new();
503+
let arena: TypedArena<Point> = TypedArena::default();
504504
assert!(arena.chunks.borrow().is_empty());
505505
}
506506

@@ -538,7 +538,7 @@ mod tests {
538538
}
539539
}
540540

541-
let arena = Wrap(TypedArena::new());
541+
let arena = Wrap(TypedArena::default());
542542

543543
let result = arena.alloc_outer(|| Outer {
544544
inner: arena.alloc_inner(|| Inner { value: 10 }),
@@ -549,15 +549,15 @@ mod tests {
549549

550550
#[test]
551551
pub fn test_copy() {
552-
let arena = TypedArena::new();
552+
let arena = TypedArena::default();
553553
for _ in 0..100000 {
554554
arena.alloc(Point { x: 1, y: 2, z: 3 });
555555
}
556556
}
557557

558558
#[bench]
559559
pub fn bench_copy(b: &mut Bencher) {
560-
let arena = TypedArena::new();
560+
let arena = TypedArena::default();
561561
b.iter(|| arena.alloc(Point { x: 1, y: 2, z: 3 }))
562562
}
563563

@@ -576,7 +576,7 @@ mod tests {
576576

577577
#[test]
578578
pub fn test_noncopy() {
579-
let arena = TypedArena::new();
579+
let arena = TypedArena::default();
580580
for _ in 0..100000 {
581581
arena.alloc(Noncopy {
582582
string: "hello world".to_string(),
@@ -587,15 +587,15 @@ mod tests {
587587

588588
#[test]
589589
pub fn test_typed_arena_zero_sized() {
590-
let arena = TypedArena::new();
590+
let arena = TypedArena::default();
591591
for _ in 0..100000 {
592592
arena.alloc(());
593593
}
594594
}
595595

596596
#[test]
597597
pub fn test_typed_arena_clear() {
598-
let mut arena = TypedArena::new();
598+
let mut arena = TypedArena::default();
599599
for _ in 0..10 {
600600
arena.clear();
601601
for _ in 0..10000 {
@@ -620,7 +620,7 @@ mod tests {
620620
fn test_typed_arena_drop_count() {
621621
let counter = Cell::new(0);
622622
{
623-
let arena: TypedArena<DropCounter> = TypedArena::new();
623+
let arena: TypedArena<DropCounter> = TypedArena::default();
624624
for _ in 0..100 {
625625
// Allocate something with drop glue to make sure it doesn't leak.
626626
arena.alloc(DropCounter { count: &counter });
@@ -632,7 +632,7 @@ mod tests {
632632
#[test]
633633
fn test_typed_arena_drop_on_clear() {
634634
let counter = Cell::new(0);
635-
let mut arena: TypedArena<DropCounter> = TypedArena::new();
635+
let mut arena: TypedArena<DropCounter> = TypedArena::default();
636636
for i in 0..10 {
637637
for _ in 0..100 {
638638
// Allocate something with drop glue to make sure it doesn't leak.
@@ -659,7 +659,7 @@ mod tests {
659659
fn test_typed_arena_drop_small_count() {
660660
DROP_COUNTER.with(|c| c.set(0));
661661
{
662-
let arena: TypedArena<SmallDroppable> = TypedArena::new();
662+
let arena: TypedArena<SmallDroppable> = TypedArena::default();
663663
for _ in 0..100 {
664664
// Allocate something with drop glue to make sure it doesn't leak.
665665
arena.alloc(SmallDroppable);
@@ -671,7 +671,7 @@ mod tests {
671671

672672
#[bench]
673673
pub fn bench_noncopy(b: &mut Bencher) {
674-
let arena = TypedArena::new();
674+
let arena = TypedArena::default();
675675
b.iter(|| {
676676
arena.alloc(Noncopy {
677677
string: "hello world".to_string(),

src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ fn f<'a>(arena: &'a TypedArena<C<'a>>) {
122122
}
123123

124124
fn main() {
125-
let arena = TypedArena::new();
125+
let arena = TypedArena::default();
126126
f(&arena);
127127
} //~^ ERROR `arena` does not live long enough

src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } }
4747
fn f<'a>(_arena: &'a TypedArena<C<'a>>) {}
4848

4949
fn main() {
50-
let arena: TypedArena<C> = TypedArena::new();
50+
let arena: TypedArena<C> = TypedArena::default();
5151
f(&arena);
5252
} //~^ ERROR `arena` does not live long enough
5353

0 commit comments

Comments
 (0)