From 5f9ca11d572d846cfbf1067cbdd8f53a198a7928 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 12 Aug 2024 23:05:44 +0200 Subject: [PATCH] refactor: removed unused Panic docs --- src/services/proxy.rs | 4 ---- src/services/torrent.rs | 1 - src/services/user.rs | 6 ------ src/web/api/server/v1/contexts/user/handlers.rs | 4 +--- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/services/proxy.rs b/src/services/proxy.rs index 99df6359..cfb0d669 100644 --- a/src/services/proxy.rs +++ b/src/services/proxy.rs @@ -38,10 +38,6 @@ impl Service { /// * The image URL is not an image. /// * The image is too big. /// * The user quota is met. - /// - /// # Panics - /// - /// The function panics if the optional user id has no value pub async fn get_image_by_url(&self, url: &str, maybe_user_id: Option) -> Result { let Some(user_id) = maybe_user_id else { return Err(Error::Unauthenticated); diff --git a/src/services/torrent.rs b/src/services/torrent.rs index f269741d..7b4876fd 100644 --- a/src/services/torrent.rs +++ b/src/services/torrent.rs @@ -129,7 +129,6 @@ impl Index { /// This function will panic if: /// /// * Unable to parse the torrent info-hash. - /// * The optional user id has no value pub async fn add_torrent( &self, add_torrent_req: AddTorrentRequest, diff --git a/src/services/user.rs b/src/services/user.rs index 49b62f02..5e837dd3 100644 --- a/src/services/user.rs +++ b/src/services/user.rs @@ -227,9 +227,6 @@ impl ProfileService { /// * An error if unable to successfully hash the password. /// * An error if unable to change the password in the database. /// * An error if it is not possible to authorize the action - /// # Panics - /// - /// The function panics if the optional user id has no value pub async fn change_password( &self, maybe_user_id: Option, @@ -304,9 +301,6 @@ impl BanService { /// * `ServiceError::InternalServerError` if unable get user from the request. /// * An error if unable to get user profile from supplied username. /// * An error if unable to set the ban of the user in the database. - /// # Panics - /// - /// The function panics if the optional user id has no value pub async fn ban_user(&self, username_to_be_banned: &str, maybe_user_id: Option) -> Result<(), ServiceError> { let Some(user_id) = maybe_user_id else { return Err(ServiceError::UnauthorizedActionForGuests); diff --git a/src/web/api/server/v1/contexts/user/handlers.rs b/src/web/api/server/v1/contexts/user/handlers.rs index 63317832..e22ed325 100644 --- a/src/web/api/server/v1/contexts/user/handlers.rs +++ b/src/web/api/server/v1/contexts/user/handlers.rs @@ -130,10 +130,8 @@ pub async fn renew_token_handler( /// It returns an error if: /// /// - The user account is not found. -/// # Panics -/// -/// The function panics if the optional user id has no value #[allow(clippy::unused_async)] +#[allow(clippy::missing_panics_doc)] pub async fn change_password_handler( State(app_data): State>, ExtractOptionalLoggedInUser(maybe_user_id): ExtractOptionalLoggedInUser,