diff --git a/backend/src/database/mod.rs b/backend/src/database/mod.rs index 3525a77..691911d 100644 --- a/backend/src/database/mod.rs +++ b/backend/src/database/mod.rs @@ -1,3 +1,3 @@ pub mod connection; -pub use connection::*; \ No newline at end of file +pub use connection::*; diff --git a/backend/src/models/task.rs b/backend/src/models/task.rs index 685f11c..3794288 100644 --- a/backend/src/models/task.rs +++ b/backend/src/models/task.rs @@ -32,7 +32,7 @@ impl TaskModel { title: &str, description: Option<&str>, ) -> Result { - if title.len() == 0 { + if title.is_empty() { bail!("Title must not be empty"); } @@ -70,10 +70,10 @@ impl TaskModel { ) .bind(&self.title) .bind(&self.description) - .bind(&self.status) + .bind(self.status) .bind(now) - .bind(&self.completed_at) - .bind(&self.id) + .bind(self.completed_at) + .bind(self.id) .execute(pool) .await?; diff --git a/backend/src/services/mod.rs b/backend/src/services/mod.rs index d29b0fe..7c095e5 100644 --- a/backend/src/services/mod.rs +++ b/backend/src/services/mod.rs @@ -9,6 +9,7 @@ use axum::{ // AppError // Borrowed from example: https://github.com/tokio-rs/axum/blob/axum-v0.8.4/examples/anyhow-error-response/src/main.rs +#[derive(Debug)] pub enum AppError { InternalError(anyhow::Error), JsonExtractError(JsonRejection), @@ -74,7 +75,7 @@ impl From for AppError { impl From for AppError { fn from(err: anyhow::Error) -> Self { - Self::InternalError(err.into()) + Self::InternalError(err) } } diff --git a/backend/src/services/tasks.rs b/backend/src/services/tasks.rs index 3773f01..1721b83 100644 --- a/backend/src/services/tasks.rs +++ b/backend/src/services/tasks.rs @@ -73,7 +73,7 @@ pub async fn update_task( let mut model = TaskModel::get_by_id(&pool, task_id).await?; if let Some(title) = input.title { - if title.len() == 0 { + if title.is_empty() { return Err(AppError::Unprocessable( "Title must not be empty".to_string(), ));