From c0c8d3aa8fdd054372f91c997913b33146bdf9bd Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 29 Aug 2012 16:11:06 -0700 Subject: core: Demode int/uint mods --- src/libcore/uint-template.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/libcore/uint-template.rs') diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index e36d0744b2c..f95848f2496 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -1,3 +1,7 @@ +// NB: transitionary, de-mode-ing. +#[forbid(deprecated_mode)]; +#[forbid(deprecated_pattern)]; + import T = inst::T; import cmp::{Eq, Ord}; @@ -20,8 +24,8 @@ const bytes : uint = (inst::bits / 8); const min_value: T = 0 as T; const max_value: T = 0 as T - 1 as T; -pure fn min(&&x: T, &&y: T) -> T { if x < y { x } else { y } } -pure fn max(&&x: T, &&y: T) -> T { if x > y { x } else { y } } +pure fn min(x: &T, y: &T) -> T { if *x < *y { *x } else { *y } } +pure fn max(x: &T, y: &T) -> T { if *x > *y { *x } else { *y } } pure fn add(x: &T, y: &T) -> T { *x + *y } pure fn sub(x: &T, y: &T) -> T { *x - *y } @@ -138,10 +142,10 @@ fn parse_buf(buf: &[const u8], radix: uint) -> Option { } /// Parse a string to an int -fn from_str(s: ~str) -> Option { parse_buf(str::to_bytes(s), 10u) } +fn from_str(s: &str) -> Option { parse_buf(str::to_bytes(s), 10u) } /// Parse a string as an unsigned integer. -fn from_str_radix(buf: ~str, radix: u64) -> Option { +fn from_str_radix(buf: &str, radix: u64) -> Option { if str::len(buf) == 0u { return None; } let mut i = str::len(buf) - 1u; let mut power = 1u64, n = 0u64; -- cgit 1.4.1-3-g733a5