From 9c3b61a365b95867c5b56ecd5ba3d2cf99e631e0 Mon Sep 17 00:00:00 2001 From: firewire Date: Fri, 20 Mar 2026 11:21:28 -0400 Subject: [PATCH] Fix up the warnings --- src/app.rs | 10 +++++----- src/main.rs | 2 +- src/search.rs | 24 +++++++++++------------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1a2d40d..fdce3dd 100644 --- a/src/app.rs +++ b/src/app.rs @@ -76,10 +76,10 @@ impl Application { ui.horizontal(|ui| { ui.label("Save location: "); ui.label(self.download_path.as_deref().unwrap_or("None")); - if ui.button("Browse").clicked() { - if let Some(path) = rfd::FileDialog::new().pick_folder() { - self.download_path = Some(path.display().to_string()); - } + if ui.button("Browse").clicked() + && let Some(path) = rfd::FileDialog::new().pick_folder() + { + self.download_path = Some(path.display().to_string()); } }); @@ -143,7 +143,7 @@ impl Application { ); let img = ColorImage::from_rgb( [1, 1], - &img_data.as_bytes(), + img_data.as_bytes(), ); let handle = ctx.load_texture( format!("preview_{}", file.name), diff --git a/src/main.rs b/src/main.rs index 61ceddd..d4cb5a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ async fn main() { eframe::run_native( "File-serve GUI v3", options, - Box::new(|cc| Ok(Box::new(app::Application::new(&cc)))), + Box::new(|cc| Ok(Box::new(app::Application::new(cc)))), ) .expect("Failed to start application"); } diff --git a/src/search.rs b/src/search.rs index e37e105..a3f9c97 100644 --- a/src/search.rs +++ b/src/search.rs @@ -1,5 +1,3 @@ -use std::ops::Deref; - use crate::util::clamp; use eframe::egui; use serde::Deserialize; @@ -33,7 +31,7 @@ pub struct SearchContext { pub is_searching: bool, pub server_url: String, pub query: String, - search_rx: Option, Metadata), String>>>, + search_rx: Option>>, pub search_results: Vec, pub page: usize, pub per_page: usize, @@ -77,11 +75,11 @@ impl SearchContext { } pub fn start_search(&mut self) -> String { - let page = self.page.clone(); - let page_size = self.per_page.clone(); + let page = self.page; + let page_size = self.per_page; let query = self.query.clone(); let url = self.server_url.clone(); - let (tx, rx) = mpsc::channel::, Metadata), String>>(1); + let (tx, rx) = mpsc::channel::>(1); self.search_rx = Some(rx); self.is_searching = true; @@ -105,13 +103,13 @@ impl SearchContext { let mut clear_rx = false; if let Some(rx) = self.search_rx.as_mut() { match rx.try_recv() { - Ok(Ok(results)) => { + Ok(Ok(root)) => { // Ok recv, ok results - self.search_results = results.0.clone(); + self.search_results = root.results.clone(); return_str = "Ready!".to_string(); - self.total_pages = results.1.total_pages; - self.page = results.1.page; - self.per_page = results.1.page_size; + self.total_pages = root.metadata.total_pages; + self.page = root.metadata.page; + self.per_page = root.metadata.page_size; self.is_searching = false; clear_rx = true; } @@ -145,7 +143,7 @@ pub async fn search_files( query: String, page: usize, page_size: usize, -) -> Result<(Vec, Metadata), String> { +) -> Result { let full_url = format!("{}?q={}&p={}&s={}", url, query, page, page_size); let client = match reqwest::Client::builder() @@ -178,5 +176,5 @@ pub async fn search_files( } }; - Ok((results.results, results.metadata)) + Ok(results) }