Skip to content

Commit

Permalink
0.1.12: language changes, removed ops for Duration in the lhs.
Browse files Browse the repository at this point in the history
- Feature flags used are all accepted.
- Orphan check workaround is no longer required.
- Impl reachability rules prevent the addition of `Duration + others`,
  as `Duration` is not implemented in this crate. Removed the impl;
  use `others + Duration` as a workaround.
  • Loading branch information
lifthrasiir committed Jan 7, 2015
1 parent e97993d commit d79c460
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 50 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.11"
version = "0.1.12"
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.10"
time = "0.1.11"

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.11
[Chrono][doc] 0.1.12
====================

[![Chrono on Travis CI][travis-image]][travis]
Expand Down
7 changes: 0 additions & 7 deletions src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,6 @@ impl<Off:Offset> Add<Duration> for Date<Off> {
}
}

impl<Off:Offset> Add<Date<Off>> for Duration {
type Output = Date<Off>;

#[inline]
fn add(self, rhs: Date<Off>) -> Date<Off> { rhs.add(self) }
}

impl<Off:Offset, Off2:Offset> Sub<Date<Off2>> for Date<Off> {
type Output = Duration;

Expand Down
7 changes: 0 additions & 7 deletions src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,6 @@ impl<Off:Offset> Add<Duration> for DateTime<Off> {
}
}

impl<Off:Offset> Add<DateTime<Off>> for Duration {
type Output = DateTime<Off>;

#[inline]
fn add(self, rhs: DateTime<Off>) -> DateTime<Off> { rhs.add(self) }
}

impl<Off:Offset, Off2:Offset> Sub<DateTime<Off2>> for DateTime<Off> {
type Output = Duration;

Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*!
# Chrono 0.1.11
# Chrono 0.1.12
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 Expand Up @@ -184,8 +184,6 @@ Advanced offset handling and date/time parsing is not yet supported (but is plan

#![doc(html_root_url = "https://lifthrasiir.github.io/rust-chrono/")]

#![feature(macro_rules, associated_types, default_type_params)]
#![feature(old_orphan_check)] // TODO: Remove this when derive(Hash) no longer needs it.
#![deny(missing_docs)]

extern crate "time" as stdtime;
Expand Down
9 changes: 1 addition & 8 deletions src/naive/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,6 @@ impl Add<Duration> for NaiveDate {
}
}

impl Add<NaiveDate> for Duration {
type Output = NaiveDate;

#[inline]
fn add(self, rhs: NaiveDate) -> NaiveDate { rhs.add(self) }
}

impl Sub<NaiveDate> for NaiveDate {
type Output = Duration;

Expand Down Expand Up @@ -709,7 +702,7 @@ mod tests {
let lhs = NaiveDate::from_ymd(y1, m1, d1);
let sum = NaiveDate::from_ymd(y, m, d);
assert_eq!(lhs + rhs, sum);
assert_eq!(rhs + lhs, sum);
//assert_eq!(rhs + lhs, sum);
}

check((2014, 1, 1), Duration::zero(), (2014, 1, 1));
Expand Down
7 changes: 0 additions & 7 deletions src/naive/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ impl Add<Duration> for NaiveDateTime {
}
}

impl Add<NaiveDateTime> for Duration {
type Output = NaiveDateTime;

#[inline]
fn add(self, rhs: NaiveDateTime) -> NaiveDateTime { rhs.add(self) }
}

impl Sub<NaiveDateTime> for NaiveDateTime {
type Output = Duration;

Expand Down
9 changes: 1 addition & 8 deletions src/naive/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,6 @@ impl Add<Duration> for NaiveTime {
}
}

impl Add<NaiveTime> for Duration {
type Output = NaiveTime;

#[inline]
fn add(self, rhs: NaiveTime) -> NaiveTime { rhs.add(self) }
}

impl Sub<NaiveTime> for NaiveTime {
type Output = Duration;

Expand Down Expand Up @@ -314,7 +307,7 @@ mod tests {
fn test_time_add() {
fn check(lhs: NaiveTime, rhs: Duration, sum: NaiveTime) {
assert_eq!(lhs + rhs, sum);
assert_eq!(rhs + lhs, sum);
//assert_eq!(rhs + lhs, sum);
}

let hmsm = |&: h,m,s,mi| NaiveTime::from_hms_milli(h, m, s, mi);
Expand Down
7 changes: 0 additions & 7 deletions src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ impl<Off:Offset> Add<Duration> for Time<Off> {
}
}

impl<Off:Offset> Add<Time<Off>> for Duration {
type Output = Time<Off>;

#[inline]
fn add(self, rhs: Time<Off>) -> Time<Off> { rhs.add(self) }
}

impl<Off:Offset, Off2:Offset> Sub<Time<Off2>> for Time<Off> {
type Output = Duration;

Expand Down

0 comments on commit d79c460

Please sign in to comment.