|
36 | 36 | use mem::transmute; |
37 | 37 | use clone::Clone; |
38 | 38 | use collections::Collection; |
39 | | -use cmp::{PartialEq, Ord, Ordering, Less, Equal, Greater}; |
| 39 | +use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Less, Equal, Greater, Equiv}; |
40 | 40 | use cmp; |
41 | 41 | use default::Default; |
42 | 42 | use iter::*; |
@@ -1422,59 +1422,49 @@ pub mod bytes { |
1422 | 1422 | // Boilerplate traits |
1423 | 1423 | // |
1424 | 1424 |
|
1425 | | -#[allow(missing_doc)] |
1426 | | -pub mod traits { |
1427 | | - use super::*; |
1428 | | - |
1429 | | - use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Equiv}; |
1430 | | - use iter::order; |
1431 | | - use collections::Collection; |
1432 | | - use option::Option; |
1433 | | - |
1434 | | - impl<'a,T:PartialEq> PartialEq for &'a [T] { |
1435 | | - fn eq(&self, other: & &'a [T]) -> bool { |
1436 | | - self.len() == other.len() && |
1437 | | - order::eq(self.iter(), other.iter()) |
1438 | | - } |
1439 | | - fn ne(&self, other: & &'a [T]) -> bool { |
1440 | | - self.len() != other.len() || |
1441 | | - order::ne(self.iter(), other.iter()) |
1442 | | - } |
| 1425 | +impl<'a,T:PartialEq> PartialEq for &'a [T] { |
| 1426 | + fn eq(&self, other: & &'a [T]) -> bool { |
| 1427 | + self.len() == other.len() && |
| 1428 | + order::eq(self.iter(), other.iter()) |
| 1429 | + } |
| 1430 | + fn ne(&self, other: & &'a [T]) -> bool { |
| 1431 | + self.len() != other.len() || |
| 1432 | + order::ne(self.iter(), other.iter()) |
1443 | 1433 | } |
| 1434 | +} |
1444 | 1435 |
|
1445 | | - impl<'a,T:Eq> Eq for &'a [T] {} |
| 1436 | +impl<'a,T:Eq> Eq for &'a [T] {} |
1446 | 1437 |
|
1447 | | - impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] { |
1448 | | - #[inline] |
1449 | | - fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } |
1450 | | - } |
| 1438 | +impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] { |
| 1439 | + #[inline] |
| 1440 | + fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } |
| 1441 | +} |
1451 | 1442 |
|
1452 | | - impl<'a,T:Ord> Ord for &'a [T] { |
1453 | | - fn cmp(&self, other: & &'a [T]) -> Ordering { |
1454 | | - order::cmp(self.iter(), other.iter()) |
1455 | | - } |
| 1443 | +impl<'a,T:Ord> Ord for &'a [T] { |
| 1444 | + fn cmp(&self, other: & &'a [T]) -> Ordering { |
| 1445 | + order::cmp(self.iter(), other.iter()) |
1456 | 1446 | } |
| 1447 | +} |
1457 | 1448 |
|
1458 | | - impl<'a, T: PartialOrd> PartialOrd for &'a [T] { |
1459 | | - #[inline] |
1460 | | - fn partial_cmp(&self, other: &&'a [T]) -> Option<Ordering> { |
1461 | | - order::partial_cmp(self.iter(), other.iter()) |
1462 | | - } |
1463 | | - #[inline] |
1464 | | - fn lt(&self, other: & &'a [T]) -> bool { |
1465 | | - order::lt(self.iter(), other.iter()) |
1466 | | - } |
1467 | | - #[inline] |
1468 | | - fn le(&self, other: & &'a [T]) -> bool { |
1469 | | - order::le(self.iter(), other.iter()) |
1470 | | - } |
1471 | | - #[inline] |
1472 | | - fn ge(&self, other: & &'a [T]) -> bool { |
1473 | | - order::ge(self.iter(), other.iter()) |
1474 | | - } |
1475 | | - #[inline] |
1476 | | - fn gt(&self, other: & &'a [T]) -> bool { |
1477 | | - order::gt(self.iter(), other.iter()) |
1478 | | - } |
| 1449 | +impl<'a, T: PartialOrd> PartialOrd for &'a [T] { |
| 1450 | + #[inline] |
| 1451 | + fn partial_cmp(&self, other: &&'a [T]) -> Option<Ordering> { |
| 1452 | + order::partial_cmp(self.iter(), other.iter()) |
| 1453 | + } |
| 1454 | + #[inline] |
| 1455 | + fn lt(&self, other: & &'a [T]) -> bool { |
| 1456 | + order::lt(self.iter(), other.iter()) |
| 1457 | + } |
| 1458 | + #[inline] |
| 1459 | + fn le(&self, other: & &'a [T]) -> bool { |
| 1460 | + order::le(self.iter(), other.iter()) |
| 1461 | + } |
| 1462 | + #[inline] |
| 1463 | + fn ge(&self, other: & &'a [T]) -> bool { |
| 1464 | + order::ge(self.iter(), other.iter()) |
| 1465 | + } |
| 1466 | + #[inline] |
| 1467 | + fn gt(&self, other: & &'a [T]) -> bool { |
| 1468 | + order::gt(self.iter(), other.iter()) |
1479 | 1469 | } |
1480 | 1470 | } |
0 commit comments