From 6b0bfe86e382de9d30570dc75ff03de43fc116e8 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Sun, 5 Apr 2026 11:36:22 +0200 Subject: [PATCH] :wastebasket: Remove unused imports, macros and fields - Drop unnecessary `axum::extract::{Path(State)}` imports in config.rs and registry.rs - Mark unused field `_position_sec` with `#[allow(dead_code)]` - Add missing attribute to dead code struct - Remove unused macros `add_action_arg!`, etc. and related types (`PlayerReport`) --- pmowebrenderer/src/config.rs | 1 - pmowebrenderer/src/pipeline.rs | 2 +- pmowebrenderer/src/register.rs | 10 ++-------- pmowebrenderer/src/registry.rs | 5 ----- pmowebrenderer/src/renderer.rs | 31 ------------------------------- 5 files changed, 3 insertions(+), 46 deletions(-) diff --git a/pmowebrenderer/src/config.rs b/pmowebrenderer/src/config.rs index efc13b4f..f4f0f3ab 100644 --- a/pmowebrenderer/src/config.rs +++ b/pmowebrenderer/src/config.rs @@ -9,7 +9,6 @@ use async_trait::async_trait; #[cfg(feature = "pmoserver")] use axum::{ Router, - extract::{Path, State}, routing::{delete, get, post}, }; diff --git a/pmowebrenderer/src/pipeline.rs b/pmowebrenderer/src/pipeline.rs index eeee9734..ceb97f03 100644 --- a/pmowebrenderer/src/pipeline.rs +++ b/pmowebrenderer/src/pipeline.rs @@ -31,7 +31,7 @@ pub use pmoaudio_ext::PlayerCommand as PipelineControl; pub struct PipelineHandle { pub player: PlayerHandle, pub stop_token: CancellationToken, - /// Volume courant (géré localement, pas dans PlayerSource) + #[allow(dead_code)] state: SharedState, } diff --git a/pmowebrenderer/src/register.rs b/pmowebrenderer/src/register.rs index e0aa4565..689235e6 100644 --- a/pmowebrenderer/src/register.rs +++ b/pmowebrenderer/src/register.rs @@ -67,7 +67,7 @@ pub async fn register_handler( #[derive(Debug, Deserialize)] pub struct PositionUpdateRequest { - pub position_sec: f64, + pub _position_sec: f64, pub duration_sec: Option, } @@ -126,6 +126,7 @@ pub async fn pause_handler( // ─── Rapports du player ───────────────────────────────────────────────────── #[derive(Debug, Deserialize)] +#[allow(dead_code)] pub struct PlayerStateReport { pub position_sec: Option, pub duration_sec: Option, @@ -133,13 +134,6 @@ pub struct PlayerStateReport { pub ready_state: Option, } -#[derive(Debug, Deserialize)] -pub struct PlayerReport { - pub instance_id: String, - #[serde(flatten)] - pub report: PlayerStateReport, -} - /// POST /api/webrenderer/{id}/report - recoit rapports position/state du player #[axum::debug_handler] pub async fn report_handler( diff --git a/pmowebrenderer/src/registry.rs b/pmowebrenderer/src/registry.rs index 7d10f650..f8a28431 100644 --- a/pmowebrenderer/src/registry.rs +++ b/pmowebrenderer/src/registry.rs @@ -3,11 +3,6 @@ //! Remplace `SessionManager` et `websocket.rs`. La session est maintenant liée //! au flux FLAC HTTP, pas à une connexion WebSocket. -use axum::{ - extract::{Path, State}, - http::StatusCode, - response::IntoResponse, -}; use parking_lot::RwLock; use std::collections::HashMap; use std::sync::Arc; diff --git a/pmowebrenderer/src/renderer.rs b/pmowebrenderer/src/renderer.rs index e0be39d0..dae1cbc6 100644 --- a/pmowebrenderer/src/renderer.rs +++ b/pmowebrenderer/src/renderer.rs @@ -46,37 +46,6 @@ pub enum FactoryError { VariableError(String), } -macro_rules! add_action_arg { - ($action:ident, $name:expr, $var:ident, $direction:ident) => {{ - $action - .add_argument(Arc::new(Argument::new_$direction( - $name.to_string(), - Arc::clone(&$var), - ))) - .map_err(|e| FactoryError::ActionError(e.to_string())) - }}; - ($action:ident, $name:expr, $var:ident, in) => { - add_action_arg!($action, $name, $var, in) - }; - ($action:ident, $name:expr, $var:ident, out) => { - add_action_arg!($action, $name, $var, out) - }; -} - -macro_rules! add_action { - ($svc:ident, $action:ident) => {{ - $svc.add_action(Arc::new($action)) - .map_err(|e| FactoryError::ActionError(e.to_string())) - }}; -} - -macro_rules! add_var { - ($svc:ident, $var:ident) => {{ - $svc.add_variable(Arc::clone(&$var)) - .map_err(|e| FactoryError::VariableError(e.to_string())) - }}; -} - /// Extrait un nom de navigateur court depuis un User-Agent complet. fn extract_browser_name(ua: &str) -> &str { if ua.contains("Edg/") || ua.contains("EdgA/") {