diff --git a/examples/sched_tokio_future.rs b/examples/sched_tokio_future.rs index e29ff0f..aed4ddf 100644 --- a/examples/sched_tokio_future.rs +++ b/examples/sched_tokio_future.rs @@ -18,12 +18,18 @@ async fn main() -> Result<()> { let mut sched = Scheduler::new(); log::debug!("scheduler created"); - + let now = chrono::Local::now(); - let handler = sched.schedule_fut("test-task", async move { - println!("I'm running at {}", &now.format("%Y-%m-%d %H:%M:%S")); - }, recur(ruleset().at_second(0))).await; + let handler = sched + .schedule_fut( + "test-task", + async move { + println!("I'm running at {}", &now.format("%Y-%m-%d %H:%M:%S")); + }, + recur(ruleset().at_second(0)), + ) + .await; sleep(std::time::Duration::from_secs(1)).await; diff --git a/lib/sched/rules/recurrent/rule_unit.rs b/lib/sched/rules/recurrent/rule_unit.rs index a0575c7..7742172 100644 --- a/lib/sched/rules/recurrent/rule_unit.rs +++ b/lib/sched/rules/recurrent/rule_unit.rs @@ -43,12 +43,9 @@ where value >= *start || value <= *end } } else if *start < *end { - value >= *start - && value <= *end - && (value - *start) % *step == T::zero() + value >= *start && value <= *end && (value - *start) % *step == T::zero() } else { - (value >= *start || value <= *end) - && (*start - value) % *step == T::zero() + (value >= *start || value <= *end) && (*start - value) % *step == T::zero() } } Rule::Many(matcher) => matcher.iter().any(|v| Self::_matches(&Rule::Val(*v), value)),