Skip to content

Commit

Permalink
0.1.11: language changes.
Browse files Browse the repository at this point in the history
- Boxed closures are gone; some unboxed closures require an explicit
  annotation for kinds (`&:` in most cases).
  • Loading branch information
lifthrasiir committed Jan 6, 2015
1 parent 883b656 commit e97993d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chrono"
version = "0.1.10"
version = "0.1.11"
authors = ["Kang Seonghoon <[email protected]>"]

description = "Date and time library for Rust"
Expand All @@ -15,5 +15,5 @@ license = "MIT/Apache-2.0"
name = "chrono"

[dependencies]
time = "0.1.9"
time = "0.1.10"

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Chrono][doc] 0.1.10
[Chrono][doc] 0.1.11
====================

[![Chrono on Travis CI][travis-image]][travis]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions src/naive/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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)));
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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)));
Expand All @@ -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)));
Expand Down
12 changes: 6 additions & 6 deletions src/naive/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand All @@ -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)),
Expand All @@ -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));
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/naive/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit e97993d

Please sign in to comment.