From 1d0def0a4081cac84ecdae4ab785e03cef327fbd Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Sat, 18 Mar 2023 12:17:28 +0200 Subject: [PATCH] chore: fix clippy warnings (#117) --- src/asynk/async_queue.rs | 9 ++------- src/lib.rs | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/asynk/async_queue.rs b/src/asynk/async_queue.rs index 877bff1e..510fc609 100644 --- a/src/asynk/async_queue.rs +++ b/src/asynk/async_queue.rs @@ -40,10 +40,11 @@ const RETRY_TASK_QUERY: &str = include_str!("queries/retry_task.sql"); pub const DEFAULT_TASK_TYPE: &str = "common"; -#[derive(Debug, Eq, PartialEq, Clone, ToSql, FromSql)] +#[derive(Debug, Eq, PartialEq, Clone, ToSql, FromSql, Default)] #[postgres(name = "fang_task_state")] pub enum FangTaskState { #[postgres(name = "new")] + #[default] New, #[postgres(name = "in_progress")] InProgress, @@ -55,12 +56,6 @@ pub enum FangTaskState { Retried, } -impl Default for FangTaskState { - fn default() -> Self { - FangTaskState::New - } -} - #[derive(TypedBuilder, Debug, Eq, PartialEq, Clone)] pub struct Task { #[builder(setter(into))] diff --git a/src/lib.rs b/src/lib.rs index afbe2356..77045137 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,22 +36,17 @@ pub enum CronError { /// All possible options for retaining tasks in the db after their execution. /// /// The default mode is [`RetentionMode::RemoveAll`] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] pub enum RetentionMode { /// Keep all tasks KeepAll, /// Remove all tasks + #[default] RemoveAll, /// Remove only successfully finished tasks RemoveFinished, } -impl Default for RetentionMode { - fn default() -> Self { - RetentionMode::RemoveAll - } -} - /// Configuration parameters for putting workers to sleep /// while they don't have any tasks to execute #[derive(Clone, Debug, TypedBuilder)]