about summary refs log tree commit diff
path: root/src/libcore/float.rs
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-08-13 17:41:45 -0700
committerGraydon Hoare <graydon@mozilla.com>2012-08-13 19:08:02 -0700
commitbc6eaf2acba7f71422e0540b0abbb7828f00b68f (patch)
tree17e0e0a12e1736cdf6eb295a70792a72db68ddac /src/libcore/float.rs
parent5394e34aa43687e36fb94656faf075b125c43bb5 (diff)
downloadrust-bc6eaf2acba7f71422e0540b0abbb7828f00b68f.tar.gz
rust-bc6eaf2acba7f71422e0540b0abbb7828f00b68f.zip
More core mode forbidding.
Diffstat (limited to 'src/libcore/float.rs')
-rw-r--r--src/libcore/float.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index 040f321b513..79e89714728 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -1,3 +1,7 @@
+// NB: transitionary, de-mode-ing.
+#[forbid(deprecated_mode)];
+#[forbid(deprecated_pattern)];
+
 //! Operations and constants for `float`
 
 // Even though this module exports everything defined in it,
@@ -238,12 +242,12 @@ fn to_str(num: float, digits: uint) -> ~str {
  * `none` if the string did not represent a valid number.  Otherwise,
  * `some(n)` where `n` is the floating-point number represented by `[num]`.
  */
-fn from_str(num: ~str) -> option<float> {
-   if num == ~"inf" {
+fn from_str(num: &str) -> option<float> {
+   if num == "inf" {
        return some(infinity as float);
-   } else if num == ~"-inf" {
+   } else if num == "-inf" {
        return some(neg_infinity as float);
-   } else if num == ~"NaN" {
+   } else if num == "NaN" {
        return some(NaN as float);
    }
 
@@ -516,7 +520,7 @@ fn test_to_str_inf() {
 
 #[test]
 fn test_traits() {
-    fn test<U:num::Num>(ten: U) {
+    fn test<U:num::Num>(ten: &U) {
         assert (ten.to_int() == 10);
 
         let two = ten.from_int(2);
@@ -529,7 +533,7 @@ fn test_traits() {
         assert (ten.modulo(two) == ten.from_int(0));
     }
 
-    test(10.0);
+    test(&10.0);
 }