diff options
Diffstat (limited to 'src/libstd/num/uint_macros.rs')
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index eb483843b5d..bbf1c497c2b 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -44,28 +44,6 @@ impl Eq for $T { fn eq(&self, other: &$T) -> bool { return (*self) == (*other); } } -impl Orderable for $T { - #[inline] - fn min(&self, other: &$T) -> $T { - if *self < *other { *self } else { *other } - } - - #[inline] - fn max(&self, other: &$T) -> $T { - if *self > *other { *self } else { *other } - } - - /// Returns the number constrained within the range `mn <= self <= mx`. - #[inline] - fn clamp(&self, mn: &$T, mx: &$T) -> $T { - match () { - _ if (*self > *mx) => *mx, - _ if (*self < *mn) => *mn, - _ => *self, - } - } -} - impl Default for $T { #[inline] fn default() -> $T { 0 } @@ -330,17 +308,6 @@ mod tests { } #[test] - fn test_orderable() { - assert_eq!((1 as $T).min(&(2 as $T)), 1 as $T); - assert_eq!((2 as $T).min(&(1 as $T)), 1 as $T); - assert_eq!((1 as $T).max(&(2 as $T)), 2 as $T); - assert_eq!((2 as $T).max(&(1 as $T)), 2 as $T); - assert_eq!((1 as $T).clamp(&(2 as $T), &(4 as $T)), 2 as $T); - assert_eq!((8 as $T).clamp(&(2 as $T), &(4 as $T)), 4 as $T); - assert_eq!((3 as $T).clamp(&(2 as $T), &(4 as $T)), 3 as $T); - } - - #[test] fn test_div_mod_floor() { assert_eq!((10 as $T).div_floor(&(3 as $T)), 3 as $T); assert_eq!((10 as $T).mod_floor(&(3 as $T)), 1 as $T); |
