Prechádzať zdrojové kódy

Avoid and remove some unstable features.

The only #[feature] left for now is the bencher.
kennytm 10 rokov pred
rodič
commit
24d2f15ccf
3 zmenil súbory, kde vykonal 9 pridanie a 9 odobranie
  1. 2 3
      benches/shootout-pidigits.rs
  2. 5 3
      src/lib.rs
  3. 2 3
      src/traits.rs

+ 2 - 3
benches/shootout-pidigits.rs

@@ -38,14 +38,13 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 // OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#![feature(core)]
 #![feature(test)]
 
 extern crate num;
 extern crate test;
 
 use std::str::FromStr;
-use std::num::{FromPrimitive, ToPrimitive};
+use num::traits::{FromPrimitive, ToPrimitive};
 
 use test::Bencher;
 
@@ -133,7 +132,7 @@ fn main() {
     let n = if args.len() < 2 {
         DEFAULT_DIGITS
     } else {
-        FromStr::from_str(args[1].as_slice()).unwrap()
+        FromStr::from_str(&args[1]).unwrap()
     };
     pidigits(n);
 }

+ 5 - 3
src/lib.rs

@@ -18,7 +18,6 @@
 //! approximate a square root to arbitrary precision:
 //!
 //! ```
-//! # #![feature(core)]
 //! extern crate num;
 //!
 //! use num::FromPrimitive;
@@ -44,7 +43,7 @@
 //!
 //! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
 //#![cfg_attr(test, deny(warnings))]
-#![cfg_attr(test, feature(hash, test))]
+#![cfg_attr(test, feature(test))]
 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/num/",
@@ -145,5 +144,8 @@ pub fn pow<T: Clone + One + Mul<T, Output = T>>(mut base: T, mut exp: usize) ->
 
 #[cfg(test)]
 fn hash<T: hash::Hash>(x: &T) -> u64 {
-    hash::hash::<T, hash::SipHasher>(x)
+    use std::hash::Hasher;
+    let mut hasher = hash::SipHasher::new();
+    x.hash(&mut hasher);
+    hasher.finish()
 }

+ 2 - 3
src/traits.rs

@@ -1329,8 +1329,8 @@ pub trait Float
     /// predicate instead.
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::{Float, FpCategory};
+    /// use num::traits::Float;
+    /// use std::num::FpCategory;
     /// use std::f32;
     ///
     /// let num = 12.4f32;
@@ -1880,7 +1880,6 @@ pub trait Float
     /// the operations were performed separately.
     ///
     /// ```
-    /// # #![feature(std_misc, core)]
     /// use num::traits::Float;
     /// use std::f64;
     ///