From 34260e7cbd4e8673e67fab2668ba5c18df439e0f Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Sat, 4 Apr 2026 00:54:13 +0200 Subject: [PATCH] :wrench: fix unused variable warning and suppress must-use lint in macros - Prefix `_object_id` parameter with underscore to silence unused variable warning in `get_item` - Add #[allow(unused_must_use)] to all action macro definitions in pmoupnp/macros.rs - Remove redundant doc comment line break --- pmosource/src/lib.rs | 2 +- pmoupnp/src/actions/macros.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pmosource/src/lib.rs b/pmosource/src/lib.rs index ec80398f..4acb903e 100644 --- a/pmosource/src/lib.rs +++ b/pmosource/src/lib.rs @@ -443,7 +443,7 @@ pub trait MusicSource: Debug + Send + Sync { /// let item = source.get_item("track-123").await?; /// println!("Now playing: {} by {}", item.title, item.artist.unwrap_or_default()); /// ``` - async fn get_item(&self, object_id: &str) -> Result { + async fn get_item(&self, _object_id: &str) -> Result { // Default implementation: try to find it in parent's browse result // This is inefficient and should be overridden by implementations Err(MusicSourceError::NotSupported( diff --git a/pmoupnp/src/actions/macros.rs b/pmoupnp/src/actions/macros.rs index f88cb0cf..8ab665a6 100644 --- a/pmoupnp/src/actions/macros.rs +++ b/pmoupnp/src/actions/macros.rs @@ -97,7 +97,6 @@ /// ``` /// /// # Notes d'implémentation -/// /// - Les `Arc` sont clonés (shallow copy du pointeur) /// - Chaque `Argument` est wrappé dans un `Arc` /// - L'`Action` finale est wrappée dans un `Arc` @@ -112,6 +111,7 @@ macro_rules! define_action { } $(with handler $handler:expr)? ) => { + #[allow(unused_must_use)] pub static $name: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| { let mut ac = $crate::actions::Action::new($action_name.to_string()); @@ -135,6 +135,7 @@ macro_rules! define_action { (pub static $name:ident = $action_name:literal stateless $(with handler $handler:expr)? ) => { + #[allow(unused_must_use)] pub static $name: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| { let mut ac = $crate::actions::Action::new($action_name.to_string()); @@ -156,6 +157,7 @@ macro_rules! define_action { } $(with handler $handler:expr)? ) => { + #[allow(unused_must_use)] pub static $name: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| { let mut ac = $crate::actions::Action::new($action_name.to_string()); @@ -178,6 +180,7 @@ macro_rules! define_action { (pub static $name:ident = $action_name:literal $(with handler $handler:expr)? ) => { + #[allow(unused_must_use)] pub static $name: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(|| { let mut ac = $crate::actions::Action::new($action_name.to_string());