Remove std::cmp::cmp2.

It isn't used anywhere and `cmp2(a, b, c, d)` is identical to
`(a, b).cmp(&(c, d))`.
This commit is contained in:
Steven Fackler 2014-03-15 21:04:56 -07:00
parent 352c5e7eb7
commit 2c372201d4

View file

@ -130,18 +130,6 @@ totalord_impl!(uint)
totalord_impl!(char)
/// Compares (a1, b1) against (a2, b2), where the a values are more significant.
pub fn cmp2<A:TotalOrd,B:TotalOrd>(
a1: &A, b1: &B,
a2: &A, b2: &B) -> Ordering
{
match a1.cmp(a2) {
Less => Less,
Greater => Greater,
Equal => b1.cmp(b2)
}
}
/**
Return `o1` if it is not `Equal`, otherwise `o2`. Simulates the
lexical ordering on a type `(int, int)`.
@ -206,14 +194,6 @@ mod test {
assert_eq!(12.cmp(-5), Greater);
}
#[test]
fn test_cmp2() {
assert_eq!(cmp2(1, 2, 3, 4), Less);
assert_eq!(cmp2(3, 2, 3, 4), Less);
assert_eq!(cmp2(5, 2, 3, 4), Greater);
assert_eq!(cmp2(5, 5, 5, 4), Greater);
}
#[test]
fn test_int_totaleq() {
assert!(5.equals(&5));