From 8139fe4cb388feea2920e55ec8177519d8d4a4ea Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Wed, 8 Oct 2025 16:20:27 +0530 Subject: [PATCH] chore: annotate unused code with #[allow(dead_code)] --- src/api.rs | 8 +++++++- src/errors.rs | 1 + src/main.rs | 1 + src/tui.rs | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api.rs b/src/api.rs index b4ddced..64b97b5 100644 --- a/src/api.rs +++ b/src/api.rs @@ -52,6 +52,7 @@ impl SonarrClient { serde_path_to_error::deserialize(deser).map_err(ApiError::from) } + #[allow(dead_code)] async fn get_debug Deserialize<'de>>(&self, endpoint: &str) -> Result { let url = format!("{}/api/v3{}", self.base_url, endpoint); let response = self @@ -68,12 +69,13 @@ impl SonarrClient { } let text = response.text().await?; - std::fs::write(endpoint.replace("/", "_"), &text); + let _ = std::fs::write(endpoint.replace("/", "_"), &text); let deser = &mut serde_json::Deserializer::from_str(&text); serde_path_to_error::deserialize(deser).map_err(ApiError::from) } + #[allow(dead_code)] async fn post Deserialize<'de>>( &self, endpoint: &str, @@ -107,10 +109,12 @@ impl SonarrClient { self.get("/series").await } + #[allow(dead_code)] pub async fn get_series_by_id(&self, id: u32) -> Result { self.get(&format!("/series/{}", id)).await } + #[allow(dead_code)] pub async fn get_episodes( &self, series_id: Option, @@ -163,6 +167,7 @@ impl SonarrClient { self.get("/history").await } + #[allow(dead_code)] pub async fn get_missing_episodes(&self) -> Result { self.get("/wanted/missing").await } @@ -179,6 +184,7 @@ impl SonarrClient { .await } + #[allow(dead_code)] pub async fn add_series(&self, series: &Series) -> Result { self.post("/series", series).await } diff --git a/src/errors.rs b/src/errors.rs index 1870c98..2964c41 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -3,4 +3,5 @@ #[error("An error occurred")] pub struct Error; +#[allow(dead_code)] pub type Result> = core::result::Result; diff --git a/src/main.rs b/src/main.rs index 0e48694..82b9227 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#[deny(warnings)] mod api; mod cli; mod config; diff --git a/src/tui.rs b/src/tui.rs index b8d11f0..05ad128 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -31,6 +31,7 @@ pub enum AppEvent { Key(crossterm::event::KeyEvent), Error(String), SeriesLoaded(Vec), + #[allow(dead_code)] EpisodesLoaded(Vec), QueueLoaded(Vec), HistoryLoaded(Vec), @@ -101,6 +102,7 @@ pub struct App { pub health: Vec, pub calendar: Vec, pub system_status: Option, + #[allow(dead_code)] pub selected_series: Option, pub loading: bool, pub error_message: Option, @@ -346,6 +348,7 @@ impl App { } } + #[allow(dead_code)] pub fn get_selected_series(&self) -> Option<&Series> { if let Some(index) = self.series_list_state.selected() { self.series.get(index) @@ -354,6 +357,7 @@ impl App { } } + #[allow(dead_code)] pub fn get_selected_search_result(&self) -> Option<&Series> { if let Some(index) = self.search_list_state.selected() { self.search_results.get(index)