From 5f09796938cbdf11a99fa023aa8baeb76571b967 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 27 Nov 2018 10:34:13 -0600 Subject: Derive PartialOrd and PartialEq for dates --- src/date.rs | 16 ++-------------- 1 file 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), AllDay(chrono::Date), @@ -109,18 +109,6 @@ impl Ord for Date { } } -impl PartialOrd for Date { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl PartialEq for Date { - fn eq(&self, other: &Self) -> bool { - self.cmp(other) == Ordering::Equal - } -} - impl Add for Date { type Output = Date; -- cgit v1.2.3