From: Brian Anderson Date: Mon, 30 Jun 2014 22:43:13 +0000 (-0700) Subject: core: Remove the unnecessary 'traits' module from 'slice' X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fa5bc6f1bd703cb081b48d032713bf78499bf155;p=rust.git core: Remove the unnecessary 'traits' module from 'slice' This is only breaking for code that references the empty `slice::traits` module. [breaking-change] --- diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index f1a694c974a..0178c0318b8 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -36,7 +36,7 @@ use mem::transmute; use clone::Clone; use collections::Collection; -use cmp::{PartialEq, Ord, Ordering, Less, Equal, Greater}; +use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Less, Equal, Greater, Equiv}; use cmp; use default::Default; use iter::*; @@ -1422,59 +1422,49 @@ pub fn copy_memory(dst: &mut [u8], src: &[u8]) { // Boilerplate traits // -#[allow(missing_doc)] -pub mod traits { - use super::*; - - use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Equiv}; - use iter::order; - use collections::Collection; - use option::Option; - - impl<'a,T:PartialEq> PartialEq for &'a [T] { - fn eq(&self, other: & &'a [T]) -> bool { - self.len() == other.len() && - order::eq(self.iter(), other.iter()) - } - fn ne(&self, other: & &'a [T]) -> bool { - self.len() != other.len() || - order::ne(self.iter(), other.iter()) - } +impl<'a,T:PartialEq> PartialEq for &'a [T] { + fn eq(&self, other: & &'a [T]) -> bool { + self.len() == other.len() && + order::eq(self.iter(), other.iter()) + } + fn ne(&self, other: & &'a [T]) -> bool { + self.len() != other.len() || + order::ne(self.iter(), other.iter()) } +} - impl<'a,T:Eq> Eq for &'a [T] {} +impl<'a,T:Eq> Eq for &'a [T] {} - impl<'a,T:PartialEq, V: Vector> Equiv for &'a [T] { - #[inline] - fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } - } +impl<'a,T:PartialEq, V: Vector> Equiv for &'a [T] { + #[inline] + fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } +} - impl<'a,T:Ord> Ord for &'a [T] { - fn cmp(&self, other: & &'a [T]) -> Ordering { - order::cmp(self.iter(), other.iter()) - } +impl<'a,T:Ord> Ord for &'a [T] { + fn cmp(&self, other: & &'a [T]) -> Ordering { + order::cmp(self.iter(), other.iter()) } +} - impl<'a, T: PartialOrd> PartialOrd for &'a [T] { - #[inline] - fn partial_cmp(&self, other: &&'a [T]) -> Option { - order::partial_cmp(self.iter(), other.iter()) - } - #[inline] - fn lt(&self, other: & &'a [T]) -> bool { - order::lt(self.iter(), other.iter()) - } - #[inline] - fn le(&self, other: & &'a [T]) -> bool { - order::le(self.iter(), other.iter()) - } - #[inline] - fn ge(&self, other: & &'a [T]) -> bool { - order::ge(self.iter(), other.iter()) - } - #[inline] - fn gt(&self, other: & &'a [T]) -> bool { - order::gt(self.iter(), other.iter()) - } +impl<'a, T: PartialOrd> PartialOrd for &'a [T] { + #[inline] + fn partial_cmp(&self, other: &&'a [T]) -> Option { + order::partial_cmp(self.iter(), other.iter()) + } + #[inline] + fn lt(&self, other: & &'a [T]) -> bool { + order::lt(self.iter(), other.iter()) + } + #[inline] + fn le(&self, other: & &'a [T]) -> bool { + order::le(self.iter(), other.iter()) + } + #[inline] + fn ge(&self, other: & &'a [T]) -> bool { + order::ge(self.iter(), other.iter()) + } + #[inline] + fn gt(&self, other: & &'a [T]) -> bool { + order::gt(self.iter(), other.iter()) } }