From 5c5a7ce5dc30e34eed70ca4455ae8e3744521ae7 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 25 Apr 2024 06:52:03 +0800 Subject: [PATCH] Fix compile error in specific feature combinations --- src/serde.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/serde.rs b/src/serde.rs index fd482ed..b020b20 100644 --- a/src/serde.rs +++ b/src/serde.rs @@ -1,4 +1,8 @@ -use crate::{parse_chrono, parse_std, parse_time}; +#[cfg(all(feature = "chrono", feature = "serde"))] +use crate::parse_chrono; +#[cfg(all(feature = "time", feature = "serde"))] +use crate::parse_time; +use crate::parse_std; use std::time::Duration; #[cfg(all(feature = "chrono", feature = "serde"))] @@ -160,7 +164,7 @@ mod tests { ); } - #[cfg(feature = "serde")] + #[cfg(all(feature = "serde", feature = "chrono"))] #[test] fn test_deserialize_duration_chrono() { use chrono::Duration; @@ -177,7 +181,7 @@ mod tests { ); } - #[cfg(feature = "serde")] + #[cfg(all(feature = "serde", feature = "chrono"))] #[test] fn test_deserialize_option_duration_chrono() { use chrono::Duration;