style: Clean up backend unused warnings

This commit is contained in:
spinline
2026-01-30 01:00:36 +03:00
parent 8216f0556a
commit 6424acaa08
4 changed files with 9 additions and 13 deletions

View File

@@ -11,10 +11,9 @@ mod xmlrpc;
use clap::Parser; use clap::Parser;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use axum::{ use axum::{
body::Body, extract::State,
extract::{Path, State},
http::{header, StatusCode, Uri}, http::{header, StatusCode, Uri},
response::{IntoResponse, Response}, response::IntoResponse,
routing::{get, post}, routing::{get, post},
Router, Json, Router, Json,
}; };

View File

@@ -1,11 +1,13 @@
use bytes::{BufMut, Bytes, BytesMut}; use bytes::Bytes;
use std::collections::HashMap; use std::collections::HashMap;
use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::UnixStream; use tokio::net::UnixStream;
#[derive(Debug)] #[derive(Debug)]
pub enum ScgiError { pub enum ScgiError {
#[allow(dead_code)]
Io(std::io::Error), Io(std::io::Error),
#[allow(dead_code)]
Protocol(String), Protocol(String),
} }
@@ -30,7 +32,7 @@ impl ScgiRequest {
} }
} }
pub fn header(mut self, key: &str, value: &str) -> Self { pub fn _header(mut self, key: &str, value: &str) -> Self {
self.headers.insert(key.to_string(), value.to_string()); self.headers.insert(key.to_string(), value.to_string());
self self
} }

View File

@@ -1,6 +1,6 @@
use axum::response::sse::{Event, Sse}; use axum::response::sse::{Event, Sse};
use futures::stream::{self, Stream}; use futures::stream::{self, Stream};
use std::{convert::Infallible, time::Duration}; use std::convert::Infallible;
use tokio_stream::StreamExt; use tokio_stream::StreamExt;
use crate::models::{AppEvent, Torrent}; use crate::models::{AppEvent, Torrent};
use crate::xmlrpc::{RtorrentClient, parse_multicall_response}; use crate::xmlrpc::{RtorrentClient, parse_multicall_response};
@@ -10,11 +10,6 @@ fn parse_size(s: &str) -> i64 {
s.parse().unwrap_or(0) s.parse().unwrap_or(0)
} }
fn parse_float(s: &str) -> f64 {
// rTorrent usually returns integers for bytes done etc.
// We might need to handle empty strings.
s.parse().unwrap_or(0.0)
}
pub async fn fetch_torrents(client: &RtorrentClient) -> Result<Vec<Torrent>, String> { pub async fn fetch_torrents(client: &RtorrentClient) -> Result<Vec<Torrent>, String> {
// d.multicall2("", "main", ...) // d.multicall2("", "main", ...)

View File

@@ -1,7 +1,7 @@
use crate::scgi::{send_request, ScgiRequest}; use crate::scgi::{send_request, ScgiRequest};
use quick_xml::events::Event; use quick_xml::events::Event;
use quick_xml::reader::Reader; use quick_xml::reader::Reader;
use serde::Deserialize;
// Simple helper to build an XML-RPC method call // Simple helper to build an XML-RPC method call
pub fn build_method_call(method: &str, params: &[&str]) -> String { pub fn build_method_call(method: &str, params: &[&str]) -> String {
@@ -159,7 +159,7 @@ pub fn parse_string_response(xml: &str) -> Result<String, String> {
} }
Ok(Event::End(ref e)) => { Ok(Event::End(ref e)) => {
if e.name().as_ref() == b"string" { if e.name().as_ref() == b"string" {
inside_string = false; // inside_string = false;
// Assuming only one string in the response which matters // Assuming only one string in the response which matters
break; break;
} }