From 32d95057a66ff3ac0d8ac98bddde5161f17dcf89 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 24 Apr 2020 12:17:59 +0200 Subject: [PATCH] cargo fmt --- src/duration/opt_ms.rs | 15 ++++++++++++--- src/duration/secs.rs | 10 ++++++++-- src/time/opt_ms_since_unix_epoch.rs | 15 ++++++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/duration/opt_ms.rs b/src/duration/opt_ms.rs index 1e8d6462..f915918a 100644 --- a/src/duration/opt_ms.rs +++ b/src/duration/opt_ms.rs @@ -13,7 +13,10 @@ use serde::{ /// /// Will fail if integer is greater than the maximum integer that can be /// unambiguously represented by an f64. -pub fn serialize(opt_duration: &Option, serializer: S) -> Result +pub fn serialize( + opt_duration: &Option, + serializer: S, +) -> Result where S: Serializer, { @@ -30,7 +33,9 @@ where /// /// Will fail if integer is greater than the maximum integer that can be /// unambiguously represented by an f64. -pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> +pub fn deserialize<'de, D>( + deserializer: D, +) -> Result, D::Error> where D: Deserializer<'de>, { @@ -47,7 +52,11 @@ mod tests { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] struct DurationTest { - #[serde(with = "super", default, skip_serializing_if = "Option::is_none")] + #[serde( + with = "super", + default, + skip_serializing_if = "Option::is_none" + )] timeout: Option, } diff --git a/src/duration/secs.rs b/src/duration/secs.rs index 830eb4d5..38a091f9 100644 --- a/src/duration/secs.rs +++ b/src/duration/secs.rs @@ -13,7 +13,10 @@ use serde::{ /// /// Will fail if integer is greater than the maximum integer that can be /// unambiguously represented by an f64. -pub fn serialize(duration: &Duration, serializer: S) -> Result +pub fn serialize( + duration: &Duration, + serializer: S, +) -> Result where S: Serializer, { @@ -64,6 +67,9 @@ mod tests { let test = DurationTest { timeout: Duration::from_millis(7000), }; - assert_eq!(serde_json::to_value(test).unwrap(), json!({ "timeout": 7 }),); + assert_eq!( + serde_json::to_value(test).unwrap(), + json!({ "timeout": 7 }), + ); } } diff --git a/src/time/opt_ms_since_unix_epoch.rs b/src/time/opt_ms_since_unix_epoch.rs index 787455ac..8ce9d280 100644 --- a/src/time/opt_ms_since_unix_epoch.rs +++ b/src/time/opt_ms_since_unix_epoch.rs @@ -14,7 +14,10 @@ use serde::{ /// /// Will fail if integer is greater than the maximum integer that can be unambiguously represented /// by an f64. -pub fn serialize(opt_time: &Option, serializer: S) -> Result +pub fn serialize( + opt_time: &Option, + serializer: S, +) -> Result where S: Serializer, { @@ -28,7 +31,9 @@ where /// /// Will fail if integer is greater than the maximum integer that can be unambiguously represented /// by an f64. -pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> +pub fn deserialize<'de, D>( + deserializer: D, +) -> Result, D::Error> where D: Deserializer<'de>, { @@ -45,7 +50,11 @@ mod tests { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] struct SystemTimeTest { - #[serde(with = "super", default, skip_serializing_if = "Option::is_none")] + #[serde( + with = "super", + default, + skip_serializing_if = "Option::is_none" + )] timestamp: Option, }