diff options
author | Fredrik Meringdal <fmeringdal@hotmail.com> | 2021-05-12 18:16:11 +0200 |
---|---|---|
committer | Fredrik Meringdal <fmeringdal@hotmail.com> | 2021-05-12 18:16:11 +0200 |
commit | 975d283aae2ad70d6831d209700df9c0bc89a0a6 (patch) | |
tree | 63e0f5aee207592956b71bbe29074a26020f4147 /src/rrule.rs | |
parent | c2ad4bb4de6f9f8a88d29ae6f3cf87708cbbf703 (diff) | |
download | rust_rrule-975d283aae2ad70d6831d209700df9c0bc89a0a6.zip |
good refactoring
Diffstat (limited to 'src/rrule.rs')
-rw-r--r-- | src/rrule.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/rrule.rs b/src/rrule.rs index 7ac6016..1d95fe9 100644 --- a/src/rrule.rs +++ b/src/rrule.rs @@ -16,15 +16,14 @@ impl RRule { /// Returns all the recurrences of the rrule pub fn all(&self) -> Vec<DateTime<Tz>> { - self.clone().into_iter().collect() + self.into_iter().collect() } /// Returns the last recurrence before the given datetime instance. /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. pub fn before(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { - self.clone() - .into_iter() + self.into_iter() .take_while(|d| if inc { *d <= dt } else { *d < dt }) .last() } @@ -33,8 +32,7 @@ impl RRule { /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. pub fn after(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { - self.clone() - .into_iter() + self.into_iter() .skip_while(|d| if inc { *d <= dt } else { *d < dt }) .next() } @@ -49,8 +47,7 @@ impl RRule { before: DateTime<Tz>, inc: bool, ) -> Vec<DateTime<Tz>> { - self.clone() - .into_iter() + self.into_iter() .skip_while(|d| if inc { *d <= after } else { *d < after }) .take_while(|d| if inc { *d <= before } else { *d < before }) .collect() |