summaryrefslogtreecommitdiff
path: root/src/rruleset.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rruleset.rs')
-rw-r--r--src/rruleset.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/rruleset.rs b/src/rruleset.rs
index c194744..d10cc3a 100644
--- a/src/rruleset.rs
+++ b/src/rruleset.rs
@@ -44,15 +44,14 @@ impl RRuleSet {
/// Returns all the recurrences of the rruleset
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()
}
@@ -61,8 +60,7 @@ impl RRuleSet {
/// 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()
}
@@ -77,8 +75,7 @@ impl RRuleSet {
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()