🗑️ 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`)
This commit is contained in:
2026-04-05 11:36:22 +02:00
parent d5b1ed5635
commit 6b0bfe86e3
5 changed files with 3 additions and 46 deletions

View File

@@ -9,7 +9,6 @@ use async_trait::async_trait;
#[cfg(feature = "pmoserver")]
use axum::{
Router,
extract::{Path, State},
routing::{delete, get, post},
};

View File

@@ -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,
}

View File

@@ -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<f64>,
}
@@ -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<f64>,
pub duration_sec: Option<f64>,
@@ -133,13 +134,6 @@ pub struct PlayerStateReport {
pub ready_state: Option<String>,
}
#[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(

View File

@@ -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;

View File

@@ -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/") {