about summary refs log tree commit diff
path: root/src/libstd/num/mod.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-24 15:58:27 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-05-01 16:44:36 -0700
commit12910418fbfd1da76cfc43ffa7a15d0b0c4acb5b (patch)
treec4939c074d8444c344b1d42f621d424f6ef2bcbe /src/libstd/num/mod.rs
parentf3345cb0a70cdac95e126b611b355ab4d36ca3df (diff)
std: Don't use a wrapper for the float error type
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.

Closes #24748
Diffstat (limited to 'src/libstd/num/mod.rs')
-rw-r--r--src/libstd/num/mod.rs33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index cd26be013c4..9a52a0214e9 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -16,16 +16,14 @@
 #![stable(feature = "rust1", since = "1.0.0")]
 #![allow(missing_docs)]
 
-use fmt;
-use core::num;
-
 pub use core::num::{Zero, One};
-pub use core::num::{FpCategory, ParseIntError};
+pub use core::num::{FpCategory, ParseIntError, ParseFloatError};
 pub use core::num::{wrapping, Wrapping};
 
-#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
 #[cfg(test)] use cmp::PartialEq;
+#[cfg(test)] use fmt;
 #[cfg(test)] use marker::Copy;
+#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
 
 /// Helper function for testing numeric operations
 #[cfg(test)]
@@ -43,31 +41,6 @@ pub fn test_num<T>(ten: T, two: T) where
     assert_eq!(ten.rem(two),  ten % two);
 }
 
-/// An error which can be returned when parsing a float.
-#[derive(Debug, Clone, PartialEq)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct ParseFloatError { inner: num::ParseFloatError }
-
-impl ::sys_common::FromInner<num::ParseFloatError> for ParseFloatError {
-    fn from_inner(inner: num::ParseFloatError) -> ParseFloatError {
-        ParseFloatError { inner: inner }
-    }
-}
-
-impl ParseFloatError {
-    #[unstable(feature = "core", reason = "available through Error trait")]
-    pub fn description(&self) -> &str {
-        self.inner.description()
-    }
-}
-
-#[stable(feature = "rust1", since = "1.0.0")]
-impl fmt::Display for ParseFloatError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.description().fmt(f)
-    }
-}
-
 #[cfg(test)]
 mod tests {
     use core::prelude::*;