From 8cc3d64d42cae40b322926f1ba36864c18a64b7c Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Wed, 29 Oct 2025 14:42:27 -0400 Subject: [PATCH] tsk-213: Code cleanup --- src/callers/queue/song.rs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/callers/queue/song.rs b/src/callers/queue/song.rs index da90870..1a1c664 100644 --- a/src/callers/queue/song.rs +++ b/src/callers/queue/song.rs @@ -105,9 +105,7 @@ pub async fn is_song_valid(data: &[u8]) -> Result { Ok(false) } } - Err(err) => { - Err(err) - } + Err(err) => Err(err), } } @@ -168,12 +166,18 @@ pub mod endpoint { results.push(queue_repo); } else { response.message = String::from("Invalid song type"); - return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response)) + return ( + axum::http::StatusCode::INTERNAL_SERVER_ERROR, + axum::Json(response), + ); } } Err(err) => { response.message = err.to_string(); - return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response)); + return ( + axum::http::StatusCode::INTERNAL_SERVER_ERROR, + axum::Json(response), + ); } } } @@ -415,7 +419,8 @@ pub mod endpoint { if valid { match repo::song::update(&pool, &raw_data, &id).await { Ok(_) => { - response.message = String::from(super::super::super::response::SUCCESSFUL); + response.message = + String::from(super::super::super::response::SUCCESSFUL); response.data.push(id); (axum::http::StatusCode::OK, axum::Json(response)) } @@ -426,12 +431,18 @@ pub mod endpoint { } } else { response.message = String::from("Invalid song type"); - return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response)) + return ( + axum::http::StatusCode::INTERNAL_SERVER_ERROR, + axum::Json(response), + ); } } Err(err) => { response.message = err.to_string(); - return (axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response)); + return ( + axum::http::StatusCode::INTERNAL_SERVER_ERROR, + axum::Json(response), + ); } } } else {