diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-10 17:59:23 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 13:39:14 -0700 |
| commit | 5cf126ae2f6af1cdac901f6995e3c2bab35e587f (patch) | |
| tree | f7e9a256438a06caa8bdc0f881e0f4bbb5a7e4de /src/libcollectionstest | |
| parent | 80bf31dd514055177b22c3dc66836d39eb5b1648 (diff) | |
| download | rust-5cf126ae2f6af1cdac901f6995e3c2bab35e587f.tar.gz rust-5cf126ae2f6af1cdac901f6995e3c2bab35e587f.zip | |
std: Remove #[old_orphan_check] from PartialEq
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). cc #19470 [breaking-change]
Diffstat (limited to 'src/libcollectionstest')
| -rw-r--r-- | src/libcollectionstest/enum_set.rs | 22 | ||||
| -rw-r--r-- | src/libcollectionstest/str.rs | 2 | ||||
| -rw-r--r-- | src/libcollectionstest/vec_deque.rs | 12 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/libcollectionstest/enum_set.rs b/src/libcollectionstest/enum_set.rs index f04367147cb..a748541fca5 100644 --- a/src/libcollectionstest/enum_set.rs +++ b/src/libcollectionstest/enum_set.rs @@ -153,19 +153,19 @@ fn test_iterator() { e1.insert(A); let elems: Vec<_> = e1.iter().collect(); - assert_eq!([A], elems); + assert_eq!(elems, [A]); e1.insert(C); let elems: Vec<_> = e1.iter().collect(); - assert_eq!([A,C], elems); + assert_eq!(elems, [A,C]); e1.insert(C); let elems: Vec<_> = e1.iter().collect(); - assert_eq!([A,C], elems); + assert_eq!(elems, [A,C]); e1.insert(B); let elems: Vec<_> = e1.iter().collect(); - assert_eq!([A,B,C], elems); + assert_eq!(elems, [A,B,C]); } /////////////////////////////////////////////////////////////////////////// @@ -183,35 +183,35 @@ fn test_operators() { let e_union = e1 | e2; let elems: Vec<_> = e_union.iter().collect(); - assert_eq!([A,B,C], elems); + assert_eq!(elems, [A,B,C]); let e_intersection = e1 & e2; let elems: Vec<_> = e_intersection.iter().collect(); - assert_eq!([C], elems); + assert_eq!(elems, [C]); // Another way to express intersection let e_intersection = e1 - (e1 - e2); let elems: Vec<_> = e_intersection.iter().collect(); - assert_eq!([C], elems); + assert_eq!(elems, [C]); let e_subtract = e1 - e2; let elems: Vec<_> = e_subtract.iter().collect(); - assert_eq!([A], elems); + assert_eq!(elems, [A]); // Bitwise XOR of two sets, aka symmetric difference let e_symmetric_diff = e1 ^ e2; let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!([A,B], elems); + assert_eq!(elems, [A,B]); // Another way to express symmetric difference let e_symmetric_diff = (e1 - e2) | (e2 - e1); let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!([A,B], elems); + assert_eq!(elems, [A,B]); // Yet another way to express symmetric difference let e_symmetric_diff = (e1 | e2) - (e1 & e2); let elems: Vec<_> = e_symmetric_diff.iter().collect(); - assert_eq!([A,B], elems); + assert_eq!(elems, [A,B]); } #[test] diff --git a/src/libcollectionstest/str.rs b/src/libcollectionstest/str.rs index 5cfa8009054..ef3373a3596 100644 --- a/src/libcollectionstest/str.rs +++ b/src/libcollectionstest/str.rs @@ -83,7 +83,7 @@ fn test_collect() { fn test_into_bytes() { let data = String::from_str("asdf"); let buf = data.into_bytes(); - assert_eq!(b"asdf", buf); + assert_eq!(buf, b"asdf"); } #[test] diff --git a/src/libcollectionstest/vec_deque.rs b/src/libcollectionstest/vec_deque.rs index fe752d5a7e1..f78356fe392 100644 --- a/src/libcollectionstest/vec_deque.rs +++ b/src/libcollectionstest/vec_deque.rs @@ -821,7 +821,7 @@ fn test_as_slices() { let (left, right) = ring.as_slices(); let expected: Vec<_> = (0..i+1).collect(); - assert_eq!(left, expected); + assert_eq!(left, &expected[..]); assert_eq!(right, []); } @@ -830,8 +830,8 @@ fn test_as_slices() { let (left, right) = ring.as_slices(); let expected_left: Vec<_> = (-last..j+1).rev().collect(); let expected_right: Vec<_> = (0..first).collect(); - assert_eq!(left, expected_left); - assert_eq!(right, expected_right); + assert_eq!(left, &expected_left[..]); + assert_eq!(right, &expected_right[..]); } assert_eq!(ring.len() as i32, cap); @@ -849,7 +849,7 @@ fn test_as_mut_slices() { let (left, right) = ring.as_mut_slices(); let expected: Vec<_> = (0..i+1).collect(); - assert_eq!(left, expected); + assert_eq!(left, &expected[..]); assert_eq!(right, []); } @@ -858,8 +858,8 @@ fn test_as_mut_slices() { let (left, right) = ring.as_mut_slices(); let expected_left: Vec<_> = (-last..j+1).rev().collect(); let expected_right: Vec<_> = (0..first).collect(); - assert_eq!(left, expected_left); - assert_eq!(right, expected_right); + assert_eq!(left, &expected_left[..]); + assert_eq!(right, &expected_right[..]); } assert_eq!(ring.len() as i32, cap); |
