about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-01 23:53:35 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-03 23:43:57 -0800
commit7d8d06f86b48520814596bd5363d2b82bc619774 (patch)
treeeda093ca208286fd8679da8de9f3597b7a024c50 /src/libstd/num
parent470118f3e915cdc8f936aca0640b28a7a3d8dc6c (diff)
downloadrust-7d8d06f86b48520814596bd5363d2b82bc619774.tar.gz
rust-7d8d06f86b48520814596bd5363d2b82bc619774.zip
Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/mod.rs13
-rw-r--r--src/libstd/num/u16.rs2
-rw-r--r--src/libstd/num/u32.rs2
-rw-r--r--src/libstd/num/u64.rs2
-rw-r--r--src/libstd/num/u8.rs2
-rw-r--r--src/libstd/num/uint.rs2
-rw-r--r--src/libstd/num/uint_macros.rs35
7 files changed, 6 insertions, 52 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 8f21fb0b8b9..c126eb1d6cf 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -21,12 +21,8 @@
 #[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
 #[cfg(test)] use kinds::Copy;
 
-pub use core::num::{Num, div_rem, Zero, zero, One, one};
-pub use core::num::{Unsigned, pow, Bounded};
-pub use core::num::{Primitive, Int, SignedInt, UnsignedInt};
+pub use core::num::{Int, SignedInt, UnsignedInt};
 pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
-pub use core::num::{next_power_of_two, is_power_of_two};
-pub use core::num::{checked_next_power_of_two};
 pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
 pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
 pub use core::num::{from_f32, from_f64};
@@ -118,11 +114,6 @@ pub trait FloatMath: Float {
 
 // DEPRECATED
 
-#[deprecated = "Use `FloatMath::abs_sub`"]
-pub fn abs_sub<T: FloatMath>(x: T, y: T) -> T {
-    x.abs_sub(y)
-}
-
 /// Helper function for testing numeric operations
 #[cfg(test)]
 pub fn test_num<T>(ten: T, two: T) where
@@ -804,7 +795,7 @@ mod bench {
 
     #[bench]
     fn bench_pow_function(b: &mut Bencher) {
-        let v = Vec::from_fn(1024u, |n| n);
+        let v = range(0, 1024u).collect::<Vec<_>>();
         b.iter(|| {v.iter().fold(0u, |old, new| old.pow(*new));});
     }
 }
diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs
index 46699b78599..7cb6a8ffe07 100644
--- a/src/libstd/num/u16.rs
+++ b/src/libstd/num/u16.rs
@@ -15,6 +15,4 @@
 
 pub use core::u16::{BITS, BYTES, MIN, MAX};
 
-use ops::FnOnce;
-
 uint_module! { u16 }
diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs
index 45ee9251d2f..43b01ddb16b 100644
--- a/src/libstd/num/u32.rs
+++ b/src/libstd/num/u32.rs
@@ -15,6 +15,4 @@
 
 pub use core::u32::{BITS, BYTES, MIN, MAX};
 
-use ops::FnOnce;
-
 uint_module! { u32 }
diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs
index 1d8ff77dac8..79e7f237051 100644
--- a/src/libstd/num/u64.rs
+++ b/src/libstd/num/u64.rs
@@ -15,6 +15,4 @@
 
 pub use core::u64::{BITS, BYTES, MIN, MAX};
 
-use ops::FnOnce;
-
 uint_module! { u64 }
diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs
index 0663ace2e5b..3da2fabe3f2 100644
--- a/src/libstd/num/u8.rs
+++ b/src/libstd/num/u8.rs
@@ -15,6 +15,4 @@
 
 pub use core::u8::{BITS, BYTES, MIN, MAX};
 
-use ops::FnOnce;
-
 uint_module! { u8 }
diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs
index cd000b3098b..0fbc0953b20 100644
--- a/src/libstd/num/uint.rs
+++ b/src/libstd/num/uint.rs
@@ -15,6 +15,4 @@
 
 pub use core::uint::{BITS, BYTES, MIN, MAX};
 
-use ops::FnOnce;
-
 uint_module! { uint }
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index b52e4fda7af..7818f4a0534 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -17,41 +17,14 @@ macro_rules! uint_module { ($T:ty) => (
 
 // String conversion functions and impl num -> str
 
-/// Convert to a string as a byte slice in a given base.
-///
-/// Use in place of x.to_string() when you do not need to store the string permanently
-///
-/// # Examples
-///
-/// ```
-/// #![allow(deprecated)]
-///
-/// std::uint::to_str_bytes(123, 10, |v| {
-///     assert!(v == "123".as_bytes());
-/// });
-/// ```
-#[inline]
-#[deprecated = "just use .to_string(), or a BufWriter with write! if you mustn't allocate"]
-pub fn to_str_bytes<U, F>(n: $T, radix: uint, f: F) -> U where
-    F: FnOnce(&[u8]) -> U,
-{
-    use io::{Writer, Seek};
-    // The radix can be as low as 2, so we need at least 64 characters for a
-    // base 2 number, and then we need another for a possible '-' character.
-    let mut buf = [0u8; 65];
-    let amt = {
-        let mut wr = ::io::BufWriter::new(&mut buf);
-        (write!(&mut wr, "{}", ::fmt::radix(n, radix as u8))).unwrap();
-        wr.tell().unwrap() as uint
-    };
-    f(buf[..amt])
-}
-
 #[cfg(test)]
 mod tests {
     use prelude::v1::*;
     use num::FromStrRadix;
-    use str::from_str;
+
+    fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> {
+        ::str::FromStr::from_str(t)
+    }
 
     #[test]
     pub fn test_from_str() {