about summary refs log tree commit diff
path: root/src/libcore/uint-template.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-29 16:11:06 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-29 16:23:36 -0700
commitc0c8d3aa8fdd054372f91c997913b33146bdf9bd (patch)
tree92ce54582b167358b3f09a0bc3861c643201c1aa /src/libcore/uint-template.rs
parentee2ce036ccd53d8c19689d86cf8b3bd5cf37f40f (diff)
core: Demode int/uint mods
Diffstat (limited to 'src/libcore/uint-template.rs')
-rw-r--r--src/libcore/uint-template.rs12
1 files changed, 8 insertions, 4 deletions
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<T> {
 }
 
 /// Parse a string to an int
-fn from_str(s: ~str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
+fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
 
 /// Parse a string as an unsigned integer.
-fn from_str_radix(buf: ~str, radix: u64) -> Option<u64> {
+fn from_str_radix(buf: &str, radix: u64) -> Option<u64> {
     if str::len(buf) == 0u { return None; }
     let mut i = str::len(buf) - 1u;
     let mut power = 1u64, n = 0u64;