Skip to content

Commit

Permalink
chore: Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leo91000 committed Dec 19, 2022
1 parent 80d7fb5 commit 506f98c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions crates/crontab_runner/src/backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
unknown_identifiers,
} = get_backfill_and_unknown_items(crontabs, &known_crontabs);

if unknown_identifiers.len() > 0 {
if !unknown_identifiers.is_empty() {
insert_unknown_crontabs(
executor.clone(),
escaped_schema,
Expand Down Expand Up @@ -109,7 +109,7 @@ where
})
.collect();

if to_backfill.len() > 0 {
if !to_backfill.is_empty() {
debug!(nb_jobs = to_backfill.len(), at = ?ts, "cron:backfill");
schedule_cron_jobs(
executor.clone(),
Expand Down
4 changes: 2 additions & 2 deletions crates/crontab_runner/src/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
query(&statement)
.bind(serde_json::to_string(crontab_jobs)?)
.bind(last_execution)
.bind(use_local_time.then(|| Local::now()))
.bind(use_local_time.then(Local::now))
.execute(executor)
.await?;

Expand All @@ -147,7 +147,7 @@ impl CrontabJob {
payload.insert(
"_cron".into(),
json!({
"ts": format!("{:?}", ts),
"ts": format!("{ts:?}"),
"backfilled": backfilled
}),
);
Expand Down
2 changes: 1 addition & 1 deletion crates/crontab_runner/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use chrono::{prelude::*, Duration};
use once_cell::sync::Lazy;

pub(crate) static DURATION_ZERO: Lazy<Duration> = Lazy::new(|| Duration::zero());
pub(crate) static DURATION_ZERO: Lazy<Duration> = Lazy::new(Duration::zero);
pub(crate) static ONE_MINUTE: Lazy<Duration> = Lazy::new(|| Duration::minutes(1));

pub(crate) fn round_date_minute<Tz: TimeZone>(
Expand Down
4 changes: 2 additions & 2 deletions crates/migrations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ where

let last_migration = match last_migration_query_result {
Err(SqlxError::Database(e)) => {
let Some(code) = e.code() else { return Err(SqlxError::Database(e).into()); };
let Some(code) = e.code() else { return Err(SqlxError::Database(e)); };

if code == "42P01" {
install_schema(executor.clone(), escaped_schema).await?;
} else {
return Err(SqlxError::Database(e).into());
return Err(SqlxError::Database(e));
}

None
Expand Down
4 changes: 2 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ impl WorkerOptions {
let de_payload = serde_json::from_str(&payload);

match de_payload {
Err(e) => Err(format!("{:?}", e)),
Err(e) => Err(format!("{e:?}")),
Ok(p) => {
let job_result = job_fn(ctx, p).await;
match job_result {
Err(e) => Err(format!("{:?}", e)),
Err(e) => Err(format!("{e:?}")),
Ok(v) => Ok(v),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sql/fail_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub async fn fail_job(

pub async fn fail_jobs(
executor: impl for<'e> PgExecutor<'e>,
jobs: &Vec<Job>,
jobs: &[Job],
escaped_schema: &str,
worker_id: &str,
message: &str,
Expand Down

0 comments on commit 506f98c

Please sign in to comment.