summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Meringdal <fmeringdal@hotmail.com>2020-10-27 11:51:51 +0100
committerFredrik Meringdal <fmeringdal@hotmail.com>2020-10-27 11:51:51 +0100
commit481cc0b759fbaccb3fbb57d090bece5ff4254efc (patch)
treeead0555af504dc55a55d1eb388565f71744f3b3f
parentdb5a3e110be58d13e82cdf4b6e51a5c3c5fac7de (diff)
downloadrust_rrule-481cc0b759fbaccb3fbb57d090bece5ff4254efc.zip
removed unused code
-rw-r--r--src/iter/mod.rs2
-rw-r--r--src/rruleset.rs10
-rw-r--r--src/rruleset_iter.rs4
-rw-r--r--src/rrulestr.rs15
4 files changed, 8 insertions, 23 deletions
diff --git a/src/iter/mod.rs b/src/iter/mod.rs
index 6a48649..8e0d4a5 100644
--- a/src/iter/mod.rs
+++ b/src/iter/mod.rs
@@ -12,7 +12,7 @@ use crate::options::*;
use crate::datetime::{Time, DTime, from_ordinal, get_weekday_val};
use chrono::offset::TimeZone;
use chrono::prelude::*;
-use chrono::{DateTime, Duration};
+use chrono::Duration;
pub trait IterResult {
fn accept(&mut self, date: DTime) -> bool;
diff --git a/src/rruleset.rs b/src/rruleset.rs
index 8326f71..2e1351b 100644
--- a/src/rruleset.rs
+++ b/src/rruleset.rs
@@ -1,5 +1,5 @@
use chrono::prelude::*;
-use chrono_tz::{Tz, UTC};
+use chrono_tz::Tz;
use crate::rrule::RRule;
use crate::datetime::DTime;
use crate::rruleset_iter::RRuleSetIter;
@@ -42,7 +42,7 @@ impl RRuleSet {
pub fn all(&mut self) -> Vec<DateTime<Tz>> {
let mut iter = RRuleSetIter::all(self);
- iter.iter(None)
+ iter.iter()
}
/// Returns the last recurrence before the given datetime instance.
@@ -50,7 +50,7 @@ impl RRuleSet {
/// With inc == true, if dt itself is an occurrence, it will be returned.
pub fn before(&mut self, date: DateTime<Tz>, inc: bool) -> Vec<DateTime<Tz>> {
let mut iter = RRuleSetIter::before(self, date, inc);
- iter.iter(None)
+ iter.iter()
}
/// Returns the last recurrence after the given datetime instance.
@@ -58,7 +58,7 @@ impl RRuleSet {
/// With inc == true, if dt itself is an occurrence, it will be returned.
pub fn after(&mut self, date: DateTime<Tz>, inc: bool) -> Vec<DateTime<Tz>> {
let mut iter = RRuleSetIter::after(self, date, inc);
- iter.iter(None)
+ iter.iter()
}
/// Returns all the occurrences of the rrule between after and before.
@@ -72,7 +72,7 @@ impl RRuleSet {
inc: bool,
) -> Vec<DateTime<Tz>> {
let mut iter = RRuleSetIter::between(self, after, before, inc);
- iter.iter(None)
+ iter.iter()
}
}
diff --git a/src/rruleset_iter.rs b/src/rruleset_iter.rs
index 3b07325..495bbf3 100644
--- a/src/rruleset_iter.rs
+++ b/src/rruleset_iter.rs
@@ -3,7 +3,7 @@ use chrono::prelude::*;
use crate::rruleset::RRuleSet;
use crate::rrule_iter::*;
use std::collections::HashMap;
-use chrono_tz::{Tz, UTC};
+use chrono_tz::Tz;
/// Result iterator for the RRuleSet type. It mostly just wraps
/// `RRuleIterRes` and also before accepting any date makes sure that
@@ -121,7 +121,7 @@ impl<'a> RRuleSetIter<'a> {
true
}
- pub fn iter(&mut self, tzid: Option<String>) -> Vec<DateTime<Tz>> {
+ pub fn iter(&mut self) -> Vec<DateTime<Tz>> {
// Add all exdates to exdate_hash
for date in &self.rrule_set.exdate {
diff --git a/src/rrulestr.rs b/src/rrulestr.rs
index b122350..452f6b0 100644
--- a/src/rrulestr.rs
+++ b/src/rrulestr.rs
@@ -4,7 +4,6 @@ use crate::rrule::RRule;
use crate::datetime::DTime;
use crate::rruleset::RRuleSet;
use chrono::prelude::*;
-use chrono::DateTime;
use chrono_tz::{UTC, Tz};
use once_cell::sync::Lazy;
use regex::Regex;
@@ -33,20 +32,6 @@ fn datestring_to_date(dt: &str, tz: &Tz) -> DTime {
);
}
-struct ParsedDateParam {
- datetime: DateTime<Tz>,
- timezone: Tz,
-}
-
-fn parse_date_param(s: &str, reg: Lazy<Regex>) -> ParsedDateParam {
- let caps = reg.captures(s);
-
- ParsedDateParam {
- datetime: UTC.timestamp_nanos(0),
- timezone: UTC
- }
-}
-
fn parse_dtstart(s: &str) -> Option<Options> {
let caps = DTSTART_RE.captures(s);