From e97993d76a87edc1a3e224b91fee599cbb675cd2 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Tue, 6 Jan 2015 22:38:37 +0900 Subject: [PATCH] 0.1.11: language changes. - Boxed closures are gone; some unboxed closures require an explicit annotation for kinds (`&:` in most cases). --- Cargo.toml | 4 ++-- README.md | 2 +- src/lib.rs | 2 +- src/naive/date.rs | 16 ++++++++-------- src/naive/datetime.rs | 12 ++++++------ src/naive/time.rs | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index caec76f..56992ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chrono" -version = "0.1.10" +version = "0.1.11" authors = ["Kang Seonghoon "] description = "Date and time library for Rust" @@ -15,5 +15,5 @@ license = "MIT/Apache-2.0" name = "chrono" [dependencies] -time = "0.1.9" +time = "0.1.10" diff --git a/README.md b/README.md index c2c9ec8..3336920 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[Chrono][doc] 0.1.10 +[Chrono][doc] 0.1.11 ==================== [![Chrono on Travis CI][travis-image]][travis] diff --git a/src/lib.rs b/src/lib.rs index 77a8f8a..86fd5de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ /*! -# Chrono 0.1.10 +# Chrono 0.1.11 Date and time handling for Rust. (also known as `rust-chrono`) It aims to be a feature-complete superset of the [time](https://github.com/rust-lang/time) library. diff --git a/src/naive/date.rs b/src/naive/date.rs index e8971e3..e137c7e 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -449,7 +449,7 @@ mod tests { #[test] fn test_date_from_ymd() { - let ymd_opt = |y,m,d| NaiveDate::from_ymd_opt(y, m, d); + let ymd_opt = |&: y,m,d| NaiveDate::from_ymd_opt(y, m, d); assert!(ymd_opt(2012, 0, 1).is_none()); assert!(ymd_opt(2012, 1, 1).is_some()); @@ -465,8 +465,8 @@ mod tests { #[test] fn test_date_from_yo() { - let yo_opt = |y,o| NaiveDate::from_yo_opt(y, o); - let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d); + let yo_opt = |&: y,o| NaiveDate::from_yo_opt(y, o); + let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d); assert_eq!(yo_opt(2012, 0), None); assert_eq!(yo_opt(2012, 1), Some(ymd(2012, 1, 1))); @@ -495,8 +495,8 @@ mod tests { #[test] fn test_date_from_isoywd() { - let isoywd_opt = |y,w,d| NaiveDate::from_isoywd_opt(y, w, d); - let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d); + let isoywd_opt = |&: y,w,d| NaiveDate::from_isoywd_opt(y, w, d); + let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d); assert_eq!(isoywd_opt(2004, 0, Weekday::Sun), None); assert_eq!(isoywd_opt(2004, 1, Weekday::Mon), Some(ymd(2003, 12, 29))); @@ -558,7 +558,7 @@ mod tests { #[test] fn test_date_from_num_days_from_ce() { - let from_ndays_from_ce = |days| NaiveDate::from_num_days_from_ce_opt(days); + let from_ndays_from_ce = |&: days| NaiveDate::from_num_days_from_ce_opt(days); assert_eq!(from_ndays_from_ce(1), Some(NaiveDate::from_ymd(1, 1, 1))); assert_eq!(from_ndays_from_ce(2), Some(NaiveDate::from_ymd(1, 1, 2))); assert_eq!(from_ndays_from_ce(31), Some(NaiveDate::from_ymd(1, 1, 31))); @@ -685,7 +685,7 @@ mod tests { #[test] fn test_date_succ() { - let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d); + let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d); assert_eq!(ymd(2014, 5, 6).succ_opt(), Some(ymd(2014, 5, 7))); assert_eq!(ymd(2014, 5, 31).succ_opt(), Some(ymd(2014, 6, 1))); assert_eq!(ymd(2014, 12, 31).succ_opt(), Some(ymd(2015, 1, 1))); @@ -695,7 +695,7 @@ mod tests { #[test] fn test_date_pred() { - let ymd = |y,m,d| NaiveDate::from_ymd(y, m, d); + let ymd = |&: y,m,d| NaiveDate::from_ymd(y, m, d); assert_eq!(ymd(2016, 3, 1).pred_opt(), Some(ymd(2016, 2, 29))); assert_eq!(ymd(2015, 1, 1).pred_opt(), Some(ymd(2014, 12, 31))); assert_eq!(ymd(2014, 6, 1).pred_opt(), Some(ymd(2014, 5, 31))); diff --git a/src/naive/datetime.rs b/src/naive/datetime.rs index 657e0bf..8d57c58 100644 --- a/src/naive/datetime.rs +++ b/src/naive/datetime.rs @@ -223,8 +223,8 @@ mod tests { #[test] fn test_datetime_from_num_seconds_from_unix_epoch() { - let from_timestamp = |secs| NaiveDateTime::from_num_seconds_from_unix_epoch_opt(secs, 0); - let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); + let from_timestamp = |&: secs| NaiveDateTime::from_num_seconds_from_unix_epoch_opt(secs, 0); + let ymdhms = |&: y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); assert_eq!(from_timestamp(-1), Some(ymdhms(1969, 12, 31, 23, 59, 59))); assert_eq!(from_timestamp(0), Some(ymdhms(1970, 1, 1, 0, 0, 0))); assert_eq!(from_timestamp(1), Some(ymdhms(1970, 1, 1, 0, 0, 1))); @@ -236,7 +236,7 @@ mod tests { #[test] fn test_datetime_add() { - let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); + let ymdhms = |&: y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) + Duration::seconds(3600 + 60 + 1), ymdhms(2014, 5, 6, 8, 9, 10)); assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) + Duration::seconds(-(3600 + 60 + 1)), @@ -251,7 +251,7 @@ mod tests { #[test] fn test_datetime_sub() { - let ymdhms = |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); + let ymdhms = |&: y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s); assert_eq!(ymdhms(2014, 5, 6, 7, 8, 9) - ymdhms(2014, 5, 6, 7, 8, 9), Duration::zero()); assert_eq!(ymdhms(2014, 5, 6, 7, 8, 10) - ymdhms(2014, 5, 6, 7, 8, 9), Duration::seconds(1)); @@ -265,8 +265,8 @@ mod tests { #[test] fn test_datetime_num_seconds_from_unix_epoch() { - let to_timestamp = - |y,m,d,h,n,s| NaiveDate::from_ymd(y,m,d).and_hms(h,n,s).num_seconds_from_unix_epoch(); + let to_timestamp = |&: y,m,d,h,n,s| + NaiveDate::from_ymd(y,m,d).and_hms(h,n,s).num_seconds_from_unix_epoch(); assert_eq!(to_timestamp(1969, 12, 31, 23, 59, 59), -1); assert_eq!(to_timestamp(1970, 1, 1, 0, 0, 0), 0); assert_eq!(to_timestamp(1970, 1, 1, 0, 0, 1), 1); diff --git a/src/naive/time.rs b/src/naive/time.rs index bad92ed..0085ebb 100644 --- a/src/naive/time.rs +++ b/src/naive/time.rs @@ -317,7 +317,7 @@ mod tests { assert_eq!(rhs + lhs, sum); } - let hmsm = |h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi); + let hmsm = |&: h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi); check(hmsm(3, 5, 7, 900), Duration::zero(), hmsm(3, 5, 7, 900)); check(hmsm(3, 5, 7, 900), Duration::milliseconds(100), hmsm(3, 5, 8, 0)); @@ -335,7 +335,7 @@ mod tests { assert_eq!(rhs - lhs, -diff); } - let hmsm = |h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi); + let hmsm = |&: h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi); check(hmsm(3, 5, 7, 900), hmsm(3, 5, 7, 900), Duration::zero()); check(hmsm(3, 5, 7, 900), hmsm(3, 5, 7, 600), Duration::milliseconds(300));