Remove the std_misc feature flag

This commit is contained in:
Erick Tryzelaar
2015-04-12 10:43:29 -07:00
parent 8ba1e7aceb
commit 7622255d6f
4 changed files with 20 additions and 10 deletions
+16 -3
View File
@@ -1,4 +1,3 @@
use std::{f32, f64};
use std::io; use std::io;
use std::num::{Float, FpCategory}; use std::num::{Float, FpCategory};
use std::string::FromUtf8Error; use std::string::FromUtf8Error;
@@ -396,7 +395,14 @@ fn fmt_f32_or_null<W>(wr: &mut W, value: f32) -> io::Result<()>
{ {
match value.classify() { match value.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"), FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"),
_ => wr.write_all(f32::to_str_digits(value, 6).as_bytes()), _ => {
let s = value.to_string();
try!(wr.write_all(s.as_bytes()));
if !s.contains('.') {
try!(wr.write_all(b".0"))
}
Ok(())
}
} }
} }
@@ -405,7 +411,14 @@ fn fmt_f64_or_null<W>(wr: &mut W, value: f64) -> io::Result<()>
{ {
match value.classify() { match value.classify() {
FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"), FpCategory::Nan | FpCategory::Infinite => wr.write_all(b"null"),
_ => wr.write_all(f64::to_str_digits(value, 6).as_bytes()), _ => {
let s = value.to_string();
try!(wr.write_all(s.as_bytes()));
if !s.contains('.') {
try!(wr.write_all(b".0"))
}
Ok(())
}
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@
//! leaving serde to perform roughly the same speed as a hand written serializer for a specific //! leaving serde to perform roughly the same speed as a hand written serializer for a specific
//! type. //! type.
#![feature(collections, core, std_misc)] #![feature(collections, core)]
pub use ser::{Serialize, Serializer}; pub use ser::{Serialize, Serializer};
+2 -5
View File
@@ -1,4 +1,3 @@
use std::collections::hash_state::HashState;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecMap}; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecMap};
use std::hash::Hash; use std::hash::Hash;
use std::path; use std::path;
@@ -151,9 +150,8 @@ impl<T> Serialize for BTreeSet<T>
} }
} }
impl<T, H> Serialize for HashSet<T, H> impl<T> Serialize for HashSet<T>
where T: Serialize + Eq + Hash, where T: Serialize + Eq + Hash,
H: HashState,
{ {
#[inline] #[inline]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
@@ -400,10 +398,9 @@ impl<K, V> Serialize for BTreeMap<K, V>
} }
} }
impl<K, V, H> Serialize for HashMap<K, V, H> impl<K, V> Serialize for HashMap<K, V>
where K: Serialize + Eq + Hash, where K: Serialize + Eq + Hash,
V: Serialize, V: Serialize,
H: HashState,
{ {
#[inline] #[inline]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
+1 -1
View File
@@ -101,7 +101,7 @@ fn test_write_i64() {
#[test] #[test]
fn test_write_f64() { fn test_write_f64() {
let tests = &[ let tests = &[
(3.0, "3"), (3.0, "3.0"),
(3.1, "3.1"), (3.1, "3.1"),
(-1.5, "-1.5"), (-1.5, "-1.5"),
(0.5, "0.5"), (0.5, "0.5"),