Skip to content

Commit 53e92f4

Browse files
committed
Update unit tests
1 parent bf3d40a commit 53e92f4

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/librustc_data_structures/snapshot_map/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::SnapshotMap;
1212

1313
#[test]
1414
fn basic() {
15-
let mut map = SnapshotMap::new();
15+
let mut map = SnapshotMap::default();
1616
map.insert(22, "twenty-two");
1717
let snapshot = map.snapshot();
1818
map.insert(22, "thirty-three");
@@ -29,7 +29,7 @@ fn basic() {
2929
#[test]
3030
#[should_panic]
3131
fn out_of_order() {
32-
let mut map = SnapshotMap::new();
32+
let mut map = SnapshotMap::default();
3333
map.insert(22, "twenty-two");
3434
let snapshot1 = map.snapshot();
3535
let _snapshot2 = map.snapshot();
@@ -38,7 +38,7 @@ fn out_of_order() {
3838

3939
#[test]
4040
fn nested_commit_then_rollback() {
41-
let mut map = SnapshotMap::new();
41+
let mut map = SnapshotMap::default();
4242
map.insert(22, "twenty-two");
4343
let snapshot1 = map.snapshot();
4444
let snapshot2 = map.snapshot();

src/librustc_data_structures/transitive_relation.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl<CTX> HashStable<CTX> for Index {
489489

490490
#[test]
491491
fn test_one_step() {
492-
let mut relation = TransitiveRelation::new();
492+
let mut relation = TransitiveRelation::default();
493493
relation.add("a", "b");
494494
relation.add("a", "c");
495495
assert!(relation.contains(&"a", &"c"));
@@ -500,7 +500,7 @@ fn test_one_step() {
500500

501501
#[test]
502502
fn test_many_steps() {
503-
let mut relation = TransitiveRelation::new();
503+
let mut relation = TransitiveRelation::default();
504504
relation.add("a", "b");
505505
relation.add("a", "c");
506506
relation.add("a", "f");
@@ -530,7 +530,7 @@ fn mubs_triangle() {
530530
// ^
531531
// |
532532
// b
533-
let mut relation = TransitiveRelation::new();
533+
let mut relation = TransitiveRelation::default();
534534
relation.add("a", "tcx");
535535
relation.add("b", "tcx");
536536
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"tcx"]);
@@ -551,7 +551,7 @@ fn mubs_best_choice1() {
551551
// need the second pare down call to get the right result (after
552552
// intersection, we have [1, 2], but 2 -> 1).
553553

554-
let mut relation = TransitiveRelation::new();
554+
let mut relation = TransitiveRelation::default();
555555
relation.add("0", "1");
556556
relation.add("0", "2");
557557

@@ -578,7 +578,7 @@ fn mubs_best_choice2() {
578578
// Like the precedecing test, but in this case intersection is [2,
579579
// 1], and hence we rely on the first pare down call.
580580

581-
let mut relation = TransitiveRelation::new();
581+
let mut relation = TransitiveRelation::default();
582582
relation.add("0", "1");
583583
relation.add("0", "2");
584584

@@ -597,7 +597,7 @@ fn mubs_best_choice2() {
597597
fn mubs_no_best_choice() {
598598
// in this case, the intersection yields [1, 2], and the "pare
599599
// down" calls find nothing to remove.
600-
let mut relation = TransitiveRelation::new();
600+
let mut relation = TransitiveRelation::default();
601601
relation.add("0", "1");
602602
relation.add("0", "2");
603603

@@ -614,7 +614,7 @@ fn mubs_best_choice_scc() {
614614
// in this case, 1 and 2 form a cycle; we pick arbitrarily (but
615615
// consistently).
616616

617-
let mut relation = TransitiveRelation::new();
617+
let mut relation = TransitiveRelation::default();
618618
relation.add("0", "1");
619619
relation.add("0", "2");
620620

@@ -636,7 +636,7 @@ fn pdub_crisscross() {
636636
// /\ |
637637
// b -> b1 ---+
638638

639-
let mut relation = TransitiveRelation::new();
639+
let mut relation = TransitiveRelation::default();
640640
relation.add("a", "a1");
641641
relation.add("a", "b1");
642642
relation.add("b", "a1");
@@ -659,7 +659,7 @@ fn pdub_crisscross_more() {
659659
// /\ /\ |
660660
// b -> b1 -> b2 ---------+
661661

662-
let mut relation = TransitiveRelation::new();
662+
let mut relation = TransitiveRelation::default();
663663
relation.add("a", "a1");
664664
relation.add("a", "b1");
665665
relation.add("b", "a1");
@@ -692,7 +692,7 @@ fn pdub_lub() {
692692
// |
693693
// b -> b1 ---+
694694

695-
let mut relation = TransitiveRelation::new();
695+
let mut relation = TransitiveRelation::default();
696696
relation.add("a", "a1");
697697
relation.add("b", "b1");
698698
relation.add("a1", "x");
@@ -715,7 +715,7 @@ fn mubs_intermediate_node_on_one_side_only() {
715715
// b
716716

717717
// "digraph { a -> c -> d; b -> d; }",
718-
let mut relation = TransitiveRelation::new();
718+
let mut relation = TransitiveRelation::default();
719719
relation.add("a", "c");
720720
relation.add("c", "d");
721721
relation.add("b", "d");
@@ -734,7 +734,7 @@ fn mubs_scc_1() {
734734
// b
735735

736736
// "digraph { a -> c -> d; d -> c; a -> d; b -> d; }",
737-
let mut relation = TransitiveRelation::new();
737+
let mut relation = TransitiveRelation::default();
738738
relation.add("a", "c");
739739
relation.add("c", "d");
740740
relation.add("d", "c");
@@ -754,7 +754,7 @@ fn mubs_scc_2() {
754754
// +--- b
755755

756756
// "digraph { a -> c -> d; d -> c; b -> d; b -> c; }",
757-
let mut relation = TransitiveRelation::new();
757+
let mut relation = TransitiveRelation::default();
758758
relation.add("a", "c");
759759
relation.add("c", "d");
760760
relation.add("d", "c");
@@ -774,7 +774,7 @@ fn mubs_scc_3() {
774774
// b ---+
775775

776776
// "digraph { a -> c -> d -> e -> c; b -> d; b -> e; }",
777-
let mut relation = TransitiveRelation::new();
777+
let mut relation = TransitiveRelation::default();
778778
relation.add("a", "c");
779779
relation.add("c", "d");
780780
relation.add("d", "e");
@@ -796,7 +796,7 @@ fn mubs_scc_4() {
796796
// b ---+
797797

798798
// "digraph { a -> c -> d -> e -> c; a -> d; b -> e; }"
799-
let mut relation = TransitiveRelation::new();
799+
let mut relation = TransitiveRelation::default();
800800
relation.add("a", "c");
801801
relation.add("c", "d");
802802
relation.add("d", "e");
@@ -834,7 +834,7 @@ fn parent() {
834834
(1, /*->*/ 3),
835835
];
836836

837-
let mut relation = TransitiveRelation::new();
837+
let mut relation = TransitiveRelation::default();
838838
for (a, b) in pairs {
839839
relation.add(a, b);
840840
}

0 commit comments

Comments
 (0)