aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuben Pollan2018-11-27 10:34:13 -0600
committerRuben Pollan2018-11-27 10:34:13 -0600
commit5f09796938cbdf11a99fa023aa8baeb76571b967 (patch)
tree165e7871642ac631babdabaf4df4c3593256d9d7 /src
parent87544cc523491e9618dc7e093349fc6501fdf46b (diff)
Derive PartialOrd and PartialEq for dates
Diffstat (limited to 'src')
-rw-r--r--src/date.rs16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/date.rs b/src/date.rs
index c329ac3..8d41c67 100644
--- a/src/date.rs
+++ b/src/date.rs
@@ -1,4 +1,4 @@
-use std::cmp::{Ordering, Ord, PartialEq, PartialOrd};
+use std::cmp::{Ordering, Ord};
use std::ops::Add;
use errors::EventError;
@@ -9,7 +9,7 @@ use chrono::offset::Utc;
use chrono_tz::{Tz, UTC};
-#[derive(Debug, Copy, Clone, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq)]
pub enum Date {
Time(chrono::DateTime<Tz>),
AllDay(chrono::Date<Tz>),
@@ -109,18 +109,6 @@ impl Ord for Date {
}
}
-impl PartialOrd for Date {
- fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- Some(self.cmp(other))
- }
-}
-
-impl PartialEq for Date {
- fn eq(&self, other: &Self) -> bool {
- self.cmp(other) == Ordering::Equal
- }
-}
-
impl Add<Duration> for Date {
type Output = Date;