From 205af655e54e79d9344604b4ae3589b8e15c631b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:34:58 +0000 Subject: [PATCH] remove unnecessary `Uri::endpoint` call --- src/cachefile.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cachefile.rs b/src/cachefile.rs index 8a676b3..98cf19a 100644 --- a/src/cachefile.rs +++ b/src/cachefile.rs @@ -31,11 +31,11 @@ impl FileState { fn start_upload( self, http: &impl Client, - endpoint: &str, + endpoint: impl FnOnce() -> String, alias_id: &str, ) -> sharry::Result { match self { - FileState::C(checked) => checked.start_upload(http, endpoint, alias_id), + FileState::C(checked) => checked.start_upload(http, &endpoint(), alias_id), FileState::U(uploading) => Ok(uploading), } } @@ -105,11 +105,12 @@ impl CacheFile { pub fn pop_file(&mut self, http: &impl Client) -> Option { if let Some(state) = self.files.pop_front() { - let endpoint = self - .uri - .endpoint(format!("alias/upload/{}/files/tus", self.share_id)); + let endpoint = || { + self.uri + .endpoint(format!("alias/upload/{}/files/tus", self.share_id)) + }; // TODO somehow retry - Some(state.start_upload(http, &endpoint, &self.alias_id).unwrap()) // HACK unwrap + Some(state.start_upload(http, endpoint, &self.alias_id).unwrap()) // HACK unwrap } else { None }