Fix some clippy complaints.
This commit is contained in:
parent
e8e2319a68
commit
5a1ce2f20a
2 changed files with 10 additions and 5 deletions
|
@ -6,10 +6,13 @@ use tokio::sync::Mutex;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let local_tz = Local::from_offset(&FixedOffset::east(7));
|
||||
let local_tz =
|
||||
Local::from_offset(&FixedOffset::east_opt(7).expect("Failed to init fixed offset"));
|
||||
let mut cron = AsyncCron::new(local_tz);
|
||||
|
||||
let first_job_id = cron.add_fn("* * * * * *", print_now).await;
|
||||
cron.add_fn("* * * * * *", print_now)
|
||||
.await
|
||||
.expect("Failed to add fn 'print_now'.");
|
||||
|
||||
cron.start().await;
|
||||
|
||||
|
@ -23,12 +26,13 @@ async fn main() {
|
|||
println!("{} counter value: {}", now, counter);
|
||||
}
|
||||
})
|
||||
.await;
|
||||
.await
|
||||
.expect("Failed to add using closure");
|
||||
|
||||
std::thread::sleep(std::time::Duration::from_secs(10));
|
||||
|
||||
// stop cron
|
||||
cron.stop();
|
||||
cron.stop().await;
|
||||
}
|
||||
|
||||
async fn print_now() {
|
||||
|
|
|
@ -2,7 +2,8 @@ use chrono::{FixedOffset, Local, TimeZone};
|
|||
use cron_tab;
|
||||
|
||||
fn main() {
|
||||
let local_tz = Local::from_offset(&FixedOffset::east(7));
|
||||
let local_tz =
|
||||
Local::from_offset(&FixedOffset::east_opt(7).expect("Failed to init fixed offset"));
|
||||
let mut cron = cron_tab::Cron::new(local_tz);
|
||||
|
||||
let first_job_id = cron.add_fn("* * * * * * *", print_now).unwrap();
|
||||
|
|
Loading…
Add table
Reference in a new issue