From fd65a0653f4c8f5a362ffc2927aa13e73360b179 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Mon, 1 Dec 2025 16:27:08 +1100 Subject: [PATCH] fix: clippy lints --- torrential/src/download.rs | 3 --- torrential/src/main.rs | 28 +++++++++------------------- torrential/src/manifest.rs | 2 -- torrential/src/remote.rs | 3 --- torrential/src/util.rs | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/torrential/src/download.rs b/torrential/src/download.rs index 8529c031..21827cb1 100644 --- a/torrential/src/download.rs +++ b/torrential/src/download.rs @@ -1,7 +1,6 @@ use std::{collections::HashMap, time::Instant}; use droplet_rs::versions::create_backend_constructor; -use log::info; use reqwest::StatusCode; use crate::{AppInitData, DownloadContext, remote::{LibraryBackend, fetch_download_context}, util::ErrorOption}; @@ -41,8 +40,6 @@ pub async fn create_download_context<'a>( } let download_context = DownloadContext { - library_id: context.library_id, - library_path: context.library_path, chunk_lookup_table, backend, last_access: Instant::now(), diff --git a/torrential/src/main.rs b/torrential/src/main.rs index 5c37207b..2e989045 100644 --- a/torrential/src/main.rs +++ b/torrential/src/main.rs @@ -1,15 +1,11 @@ -use anyhow::{Result, anyhow}; +use anyhow::Result; use dashmap::DashMap; use droplet_rs::versions::types::{VersionBackend, VersionFile}; use reqwest::header; use simple_logger::SimpleLogger; use std::{ - collections::HashMap, - env::set_current_dir, - path::PathBuf, - str::FromStr, - sync::Arc, - time::{Duration, Instant}, + collections::HashMap, env::set_current_dir, path::PathBuf, str::FromStr, sync::Arc, + time::Instant, }; use tokio_util::io::ReaderStream; @@ -23,10 +19,7 @@ use axum::{ }; use log::{error, info, warn}; use serde::Deserialize; -use tokio::{ - sync::{OnceCell, Semaphore}, - time::sleep, -}; +use tokio::sync::{OnceCell, Semaphore}; use crate::{ download::create_download_context, @@ -41,8 +34,6 @@ mod util; static GLOBAL_CONTEXT_SEMAPHORE: Semaphore = Semaphore::const_new(1); struct DownloadContext<'a> { - library_id: String, - library_path: String, chunk_lookup_table: HashMap, backend: Box, last_access: Instant, @@ -57,7 +48,6 @@ struct AppInitData { struct AppState<'a> { token: OnceCell, context_cache: DashMap<(String, String), DownloadContext<'a>>, - working_context_cache: DashMap<(String, String), Semaphore>, } async fn serve_file( @@ -155,10 +145,11 @@ async fn set_token( let valid_library_sources = library_sources .into_iter() - .filter(|v| match v.backend { - remote::LibraryBackend::Filesystem | remote::LibraryBackend::FlatFilesystem => true, - #[allow(unreachable_patterns)] - _ => false, + .filter(|v| { + matches!( + v.backend, + remote::LibraryBackend::Filesystem | remote::LibraryBackend::FlatFilesystem + ) }) .map(|v| { let path = PathBuf::from_str( @@ -206,7 +197,6 @@ async fn main() { let shared_state = Arc::new(AppState { token: OnceCell::new(), context_cache: DashMap::new(), - working_context_cache: DashMap::new(), }); let app = Router::new() diff --git a/torrential/src/manifest.rs b/torrential/src/manifest.rs index fabe92d5..f928f23c 100644 --- a/torrential/src/manifest.rs +++ b/torrential/src/manifest.rs @@ -4,9 +4,7 @@ use serde::Deserialize; #[derive(Deserialize)] pub struct DropChunk { - pub permissions: usize, pub ids: Vec, - pub checksums: Vec, pub lengths: Vec, } diff --git a/torrential/src/remote.rs b/torrential/src/remote.rs index ab92bf9c..e40f4cc0 100644 --- a/torrential/src/remote.rs +++ b/torrential/src/remote.rs @@ -10,9 +10,7 @@ use crate::{manifest::DropletManifest, util::ErrorOption}; #[derive(Deserialize)] #[serde(rename_all = "camelCase")] pub struct ContextResponseBody { - timeout: String, pub manifest: DropletManifest, - version_name: String, pub library_id: String, pub library_path: String, } @@ -88,7 +86,6 @@ pub enum LibraryBackend { pub struct LibrarySource { pub options: serde_json::Value, pub id: String, - name: String, pub backend: LibraryBackend } diff --git a/torrential/src/util.rs b/torrential/src/util.rs index f88b71d5..07e319cb 100644 --- a/torrential/src/util.rs +++ b/torrential/src/util.rs @@ -1,5 +1,5 @@ use log::error; -use reqwest::{StatusCode, Url}; +use reqwest::StatusCode; #[derive(Debug)] pub struct ErrorOption(Result);