From fae0a2b502a04b2749f12f7ddb04d72ee86e60dd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 26 Sep 2017 18:23:28 +0200 Subject: Fix feature-gate-caused compiler errors --- src/indicator.rs | 16 ++++++++++++++-- src/iter.rs | 4 +++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/indicator.rs b/src/indicator.rs index 72e1136..fa9bf63 100644 --- a/src/indicator.rs +++ b/src/indicator.rs @@ -1,3 +1,15 @@ +#[cfg(feature = "with-filters")] +use filters::filter::Filter; + +#[cfg(feature = "with-filters")] +use filters::filter::IntoFilter; + +#[cfg(feature = "with-filters")] +use timetype::TimeType; + +#[cfg(feature = "with-filters")] +use chrono::Datelike; + #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)] pub enum Day { Monday, @@ -64,7 +76,7 @@ pub struct DayFilter(Day); #[cfg(feature = "with-filters")] impl Filter for DayFilter { fn filter(&self, tt: &TimeType) -> bool { - tt.get_moment(|mom| mom.weekday() == self.0.into()).unwrap_or(false) + tt.get_moment().map(|mom| mom.weekday() == self.0.clone().into()).unwrap_or(false) } } @@ -85,7 +97,7 @@ pub struct MonthFilter(Month); #[cfg(feature = "with-filters")] impl Filter for MonthFilter { fn filter(&self, tt: &TimeType) -> bool { - tt.get_moment(|mom| mom.month() == self.0.into()).unwrap_or(false) + tt.get_moment().map(|mom| mom.month() == self.0.clone().into()).unwrap_or(false) } } diff --git a/src/iter.rs b/src/iter.rs index 9713e51..4e7c18c 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -381,6 +381,8 @@ mod type_tests { mod type_tests_filter_interface { use super::*; use super::extensions::*; + use filters::filter::Filter; + use filters::filter::IntoFilter; #[test] fn test_compile() { @@ -388,7 +390,7 @@ mod type_tests_filter_interface { let _ = TimeType::today() .yearly(1) .unwrap() - .every(::indicator::Day::Monday.or(::indicator::Month::January)) + .every(::indicator::Day::Monday.into_filter().or(::indicator::Month::January)) .collect::>(); } } -- cgit v1.2.3