From 7339d6cb9a18248650774b06fbb0d748a1c8b774 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Tue, 16 Aug 2016 00:45:20 +0200 Subject: [PATCH 1/3] Remove redundant `use serde`; it is an external crate. --- rational/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/rational/src/lib.rs b/rational/src/lib.rs index 7aa036f..07f780b 100644 --- a/rational/src/lib.rs +++ b/rational/src/lib.rs @@ -28,9 +28,6 @@ use std::hash; use std::ops::{Add, Div, Mul, Neg, Rem, Sub}; use std::str::FromStr; -#[cfg(feature = "serde")] -use serde; - #[cfg(feature = "num-bigint")] use bigint::{BigInt, BigUint, Sign}; From 20360ebccf547f4197291f9abf7aeb101db97850 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Tue, 16 Aug 2016 00:46:49 +0200 Subject: [PATCH 2/3] Fix deserialization by giving type annotations. --- rational/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rational/src/lib.rs b/rational/src/lib.rs index 07f780b..dec7400 100644 --- a/rational/src/lib.rs +++ b/rational/src/lib.rs @@ -601,7 +601,7 @@ impl serde::Deserialize for Ratio fn deserialize(deserializer: &mut D) -> Result where D: serde::Deserializer { - let (numer, denom) = try!(serde::Deserialize::deserialize(deserializer)); + let (numer, denom): (T,T) = try!(serde::Deserialize::deserialize(deserializer)); if denom.is_zero() { Err(serde::de::Error::invalid_value("denominator is zero")) } else { From eb486e8dc149cbd49c7c111860079430f8906358 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Wed, 17 Aug 2016 12:19:51 +0200 Subject: [PATCH 3/3] Add build test for serde feature --- .travis/test_nightly.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis/test_nightly.sh b/.travis/test_nightly.sh index 43a0fec..19ee864 100755 --- a/.travis/test_nightly.sh +++ b/.travis/test_nightly.sh @@ -5,3 +5,6 @@ set -ex cargo bench --verbose cargo test --verbose --manifest-path=macros/Cargo.toml + +# Build test for the serde feature +cargo build --verbose --features "serde"