From 741e33c3afc20f31fae06c860bbdbea3cf60f3a9 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Thu, 2 Apr 2026 18:54:58 +0200 Subject: [PATCH] Clean up some clanker-written code Signed-off-by: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> --- src/downloader/tweets.rs | 4 ++-- src/main.rs | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/downloader/tweets.rs b/src/downloader/tweets.rs index 9e43759..e00c2f1 100644 --- a/src/downloader/tweets.rs +++ b/src/downloader/tweets.rs @@ -7,7 +7,7 @@ use std::{ fs, path::{Path, PathBuf}, process::Command, - sync::{Mutex, OnceLock}, + sync::OnceLock, }; use super::local; @@ -281,7 +281,7 @@ fn archive_asset_reference( mod tests { use super::*; use std::{ - sync::MutexGuard, + sync::{Mutex, MutexGuard}, time::{SystemTime, UNIX_EPOCH}, }; diff --git a/src/main.rs b/src/main.rs index dba347c..3352fad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -356,7 +356,6 @@ fn main() -> Result<()> { }; let source = determine_source(path); - let resolved_path = resolve_source_path(path, &source); match source { Source::Other => { @@ -394,6 +393,7 @@ fn main() -> Result<()> { } // Other sources + let path = resolve_source_path(path, &source); let hash = match source { Source::YouTubeVideo | Source::X @@ -402,11 +402,7 @@ fn main() -> Result<()> { | Source::TikTok | Source::Reddit | Source::Snapchat => { - match downloader::ytdlp::download( - resolved_path.clone(), - &store_path, - ×tamp, - ) { + match downloader::ytdlp::download(path.clone(), &store_path, ×tamp) { Ok(h) => h, Err(e) => { eprintln!("Failed to download from YouTube: {e}"); @@ -415,7 +411,7 @@ fn main() -> Result<()> { } } Source::Local => { - match downloader::local::save(resolved_path.clone(), &store_path, ×tamp) { + match downloader::local::save(path.clone(), &store_path, ×tamp) { Ok(h) => h, Err(e) => { eprintln!("Failed to archive local file: {e}"); @@ -435,7 +431,7 @@ fn main() -> Result<()> { | Source::Reddit | Source::Snapchat => ".mp4", Source::Local => { - let p = Path::new(resolved_path.trim_start_matches("file://")); + let p = Path::new(path.trim_start_matches("file://")); &p.extension() .map_or(String::new(), |ext| format!(".{}", ext.to_string_lossy())) }