From 33f92308e8fe3f88a80b11eb7b2dee1d27977443 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Tue, 22 Aug 2017 05:29:28 +1000 Subject: Upgrade chrono from 0.3 to 0.4 (#23) --- src/binary/reader.rs | 4 ++-- src/date.rs | 16 ++++++++-------- src/plist.rs | 4 ++-- src/xml/reader.rs | 4 ++-- src/xml/writer.rs | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/binary/reader.rs b/src/binary/reader.rs index 25ead2a..f63f127 100644 --- a/src/binary/reader.rs +++ b/src/binary/reader.rs @@ -320,7 +320,7 @@ impl Iterator for EventReader { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::fs::File; use std::path::Path; @@ -346,7 +346,7 @@ mod tests { StringValue("Height".to_owned()), RealValue(1.60), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), StringValue("Author".to_owned()), StringValue("William Shakespeare".to_owned()), StringValue("Data".to_owned()), diff --git a/src/date.rs b/src/date.rs index 55aa205..4091f28 100644 --- a/src/date.rs +++ b/src/date.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Duration, TimeZone, UTC}; +use chrono::{DateTime, Duration, TimeZone, Utc}; use std::fmt; use std::str::FromStr; @@ -7,7 +7,7 @@ use {Error, Result}; /// A UTC timestamp. Used for serialization to and from the plist date type. #[derive(Clone, Debug, PartialEq)] pub struct Date { - inner: DateTime, + inner: DateTime, } impl Date { @@ -32,21 +32,21 @@ impl Date { let dur = Duration::milliseconds(whole_millis as i64); let dur = dur + Duration::nanoseconds(submilli_nanos as i64); - let plist_epoch = UTC.ymd(2001, 1, 1).and_hms(0, 0, 0); + let plist_epoch = Utc.ymd(2001, 1, 1).and_hms(0, 0, 0); let date = plist_epoch.checked_add_signed(dur).ok_or(Error::InvalidData)?; Ok(Date { inner: date }) } } -impl From> for Date { - fn from(date: DateTime) -> Self { +impl From> for Date { + fn from(date: DateTime) -> Self { Date { inner: date } } } -impl Into> for Date { - fn into(self) -> DateTime { +impl Into> for Date { + fn into(self) -> DateTime { self.inner } } @@ -62,7 +62,7 @@ impl FromStr for Date { fn from_str(s: &str) -> ::std::result::Result { let date = DateTime::parse_from_rfc3339(s).map_err(|_| ())?; - Ok(Date { inner: date.with_timezone(&UTC) }) + Ok(Date { inner: date.with_timezone(&Utc) }) } } diff --git a/src/plist.rs b/src/plist.rs index 7930754..27df833 100644 --- a/src/plist.rs +++ b/src/plist.rs @@ -339,7 +339,7 @@ mod tests { #[test] fn test_plist_access() { use std::collections::BTreeMap; - use chrono::*; + use chrono::prelude::*; use super::Date; let vec = vec![Plist::Real(0.0)]; @@ -360,7 +360,7 @@ mod tests { assert_eq!(Plist::Data(slice.to_vec()).into_data(), Some(slice.to_vec())); - let date: Date = UTC::now().into(); + let date: Date = Utc::now().into(); assert_eq!(Plist::Date(date.clone()).as_date(), Some(&date)); assert_eq!(Plist::Real(0.0).as_real(), Some(0.0)); diff --git a/src/xml/reader.rs b/src/xml/reader.rs index 465d264..e6b6953 100644 --- a/src/xml/reader.rs +++ b/src/xml/reader.rs @@ -146,7 +146,7 @@ impl Iterator for EventReader { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::fs::File; use std::path::Path; @@ -176,7 +176,7 @@ mod tests { StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), StringValue("Blank".to_owned()), StringValue("".to_owned()), EndDictionary]; diff --git a/src/xml/writer.rs b/src/xml/writer.rs index 5d2e2f0..7048b32 100644 --- a/src/xml/writer.rs +++ b/src/xml/writer.rs @@ -187,7 +187,7 @@ impl PlistEventWriter for EventWriter { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::io::Cursor; use super::*; @@ -211,7 +211,7 @@ mod tests { StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), EndDictionary]; let mut cursor = Cursor::new(Vec::new()); -- cgit v1.2.3