diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-08-17 13:23:36 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-17 14:03:32 -0700 |
| commit | 8cb4d8671afecdcfd2432e08c8f43673ce51f67d (patch) | |
| tree | c42f8eb09400c6b9d5004d22155299eb0be03410 /src/libstd/num | |
| parent | 47ea0cfb6bd250c970e3a61d62bfa1b1c7bb27d4 (diff) | |
| download | rust-8cb4d8671afecdcfd2432e08c8f43673ce51f67d.tar.gz rust-8cb4d8671afecdcfd2432e08c8f43673ce51f67d.zip | |
std: Clean up primitive integer modules
All of the modules in the standard library were just straight reexports of those in libcore, so remove all the "macro modules" from the standard library and just reexport what's in core directly.
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/float_macros.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/i16.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/i32.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/i64.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/i8.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/int_macros.rs | 15 | ||||
| -rw-r--r-- | src/libstd/num/isize.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/u16.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/u32.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/u64.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/u8.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 50 | ||||
| -rw-r--r-- | src/libstd/num/usize.rs | 19 |
13 files changed, 0 insertions, 274 deletions
diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs deleted file mode 100644 index 16ad21a07d7..00000000000 --- a/src/libstd/num/float_macros.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![doc(hidden)] - -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs deleted file mode 100644 index eb53e0821f2..00000000000 --- a/src/libstd/num/i16.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 16-bit signed integer type. -//! -//! *[See also the `i16` primitive type](../primitive.i16.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::i16::{BITS, BYTES, MIN, MAX}; - -int_module! { i16 } diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs deleted file mode 100644 index 3c9eedf38c7..00000000000 --- a/src/libstd/num/i32.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 32-bit signed integer type. -//! -//! *[See also the `i32` primitive type](../primitive.i32.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::i32::{BITS, BYTES, MIN, MAX}; - -int_module! { i32 } diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs deleted file mode 100644 index 2df7478a820..00000000000 --- a/src/libstd/num/i64.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 64-bit signed integer type. -//! -//! *[See also the `i64` primitive type](../primitive.i64.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::i64::{BITS, BYTES, MIN, MAX}; - -int_module! { i64 } diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs deleted file mode 100644 index 4e4bee8a791..00000000000 --- a/src/libstd/num/i8.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 8-bit signed integer type. -//! -//! *[See also the `i8` primitive type](../primitive.i8.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::i8::{BITS, BYTES, MIN, MAX}; - -int_module! { i8 } diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs deleted file mode 100644 index 178fad09f98..00000000000 --- a/src/libstd/num/int_macros.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![doc(hidden)] - -macro_rules! int_module { ($T:ty) => ( - -) } diff --git a/src/libstd/num/isize.rs b/src/libstd/num/isize.rs deleted file mode 100644 index d46b6b80d0d..00000000000 --- a/src/libstd/num/isize.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The pointer-sized signed integer type. -//! -//! *[See also the `isize` primitive type](../primitive.isize.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::isize::{BITS, BYTES, MIN, MAX}; - -int_module! { isize } diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs deleted file mode 100644 index 893618aeffa..00000000000 --- a/src/libstd/num/u16.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 16-bit unsigned integer type. -//! -//! *[See also the `u16` primitive type](../primitive.u16.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::u16::{BITS, BYTES, MIN, MAX}; - -uint_module! { u16 } diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs deleted file mode 100644 index 2da25519696..00000000000 --- a/src/libstd/num/u32.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 32-bit unsigned integer type. -//! -//! *[See also the `u32` primitive type](../primitive.u32.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::u32::{BITS, BYTES, MIN, MAX}; - -uint_module! { u32 } diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs deleted file mode 100644 index 26a8b537394..00000000000 --- a/src/libstd/num/u64.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 64-bit unsigned integer type. -//! -//! *[See also the `u64` primitive type](../primitive.u64.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::u64::{BITS, BYTES, MIN, MAX}; - -uint_module! { u64 } diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs deleted file mode 100644 index 385754b93a0..00000000000 --- a/src/libstd/num/u8.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The 8-bit unsigned integer type. -//! -//! *[See also the `u8` primitive type](../primitive.u8.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::u8::{BITS, BYTES, MIN, MAX}; - -uint_module! { u8 } diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs deleted file mode 100644 index 902c78c0a46..00000000000 --- a/src/libstd/num/uint_macros.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![doc(hidden)] - -macro_rules! uint_module { ($T:ident) => ( - -#[cfg(test)] -mod tests { - use prelude::v1::*; - - fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> { - ::str::FromStr::from_str(t).ok() - } - - #[test] - pub fn test_from_str() { - assert_eq!(from_str::<$T>("0"), Some(0 as $T)); - assert_eq!(from_str::<$T>("3"), Some(3 as $T)); - assert_eq!(from_str::<$T>("10"), Some(10 as $T)); - assert_eq!(from_str::<u32>("123456789"), Some(123456789 as u32)); - assert_eq!(from_str::<$T>("00100"), Some(100 as $T)); - - assert_eq!(from_str::<$T>(""), None); - assert_eq!(from_str::<$T>(" "), None); - assert_eq!(from_str::<$T>("x"), None); - } - - #[test] - pub fn test_parse_bytes() { - assert_eq!($T::from_str_radix("123", 10), Ok(123 as $T)); - assert_eq!($T::from_str_radix("1001", 2), Ok(9 as $T)); - assert_eq!($T::from_str_radix("123", 8), Ok(83 as $T)); - assert_eq!(u16::from_str_radix("123", 16), Ok(291 as u16)); - assert_eq!(u16::from_str_radix("ffff", 16), Ok(65535 as u16)); - assert_eq!($T::from_str_radix("z", 36), Ok(35 as $T)); - - assert_eq!($T::from_str_radix("Z", 10).ok(), None::<$T>); - assert_eq!($T::from_str_radix("_", 2).ok(), None::<$T>); - } -} - -) } diff --git a/src/libstd/num/usize.rs b/src/libstd/num/usize.rs deleted file mode 100644 index 6960ba3b829..00000000000 --- a/src/libstd/num/usize.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The pointer-sized unsigned integer type. -//! -//! *[See also the `usize` primitive type](../primitive.usize.html).* - -#![stable(feature = "rust1", since = "1.0.0")] - -pub use core::usize::{BITS, BYTES, MIN, MAX}; - -uint_module! { usize } |
