From aed69c2a4766b4936ca44c22db9b98bf7a7db51a Mon Sep 17 00:00:00 2001 From: Lucas Colombo Date: Tue, 23 Apr 2024 12:20:06 -0300 Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=92=84=20linting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/sched_tokio_future.rs | 14 ++++++++++---- lib/sched/rules/recurrent/rule_unit.rs | 7 ++----- 2 files changed, 12 insertions(+), 9 deletions(-) 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)),