From 099367964119afef2f1c958b371f2a4ce12bdaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Wed, 11 Jun 2025 00:06:08 +0000 Subject: [PATCH] [wip] impl `Client` for `ureq::Agent` - clippy fix --- src/appstate.rs | 2 +- src/file/chunk.rs | 2 +- src/sharry/api.rs | 2 +- src/sharry/client.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/appstate.rs b/src/appstate.rs index 04ac109..dbec49b 100644 --- a/src/appstate.rs +++ b/src/appstate.rs @@ -55,7 +55,7 @@ impl FileState { ) -> sharry::Result { match self { FileState::C(checked) => { - let endpoint = &uri.endpoint(format!("alias/upload/{}/files/tus", share_id)); + let endpoint = &uri.endpoint(format!("alias/upload/{share_id}/files/tus")); checked.start_upload(http, endpoint, alias_id) } FileState::U(uploading) => Ok(uploading), diff --git a/src/file/chunk.rs b/src/file/chunk.rs index bf57c93..838e66b 100644 --- a/src/file/chunk.rs +++ b/src/file/chunk.rs @@ -23,7 +23,7 @@ impl<'t> Chunk<'t> { // BOOKMARK this might **panic** on platforms where `usize` has more than 64 bit. // Also, you've allocated more than 2 EiB ... in ONE chunk. // Whoa! Maybe just chill? - u64::try_from(len).unwrap_or_else(|e| panic!("usize={} did not fit into u64: {}", len, e)) + u64::try_from(len).unwrap_or_else(|e| panic!("usize={len} did not fit into u64: {e}")) } pub fn get_patch_uri(&self) -> &str { diff --git a/src/sharry/api.rs b/src/sharry/api.rs index 2b5ddb5..9f51932 100644 --- a/src/sharry/api.rs +++ b/src/sharry/api.rs @@ -18,7 +18,7 @@ impl Uri { } pub fn endpoint(&self, endpoint: impl fmt::Display) -> String { - let uri = format!("{}/{}", self, endpoint); + let uri = format!("{self}/{endpoint}"); debug!("endpoint: {uri:?}"); uri diff --git a/src/sharry/client.rs b/src/sharry/client.rs index 8c32799..e857faa 100644 --- a/src/sharry/client.rs +++ b/src/sharry/client.rs @@ -102,7 +102,7 @@ impl Client for ureq::Agent { .post(endpoint) .header("Sharry-Alias", alias_id) .send_empty() - .map_err(|e| ClientError::req_err(e))?; + .map_err(ClientError::req_err)?; trace!("{endpoint:?} response: {res:?}"); ClientError::res_check_status(res.status(), ureq::http::StatusCode::OK)?; @@ -110,7 +110,7 @@ impl Client for ureq::Agent { let res = res .body_mut() .read_json::() - .map_err(|e| ClientError::res_parse_err(e))?; + .map_err(ClientError::res_parse_err)?; debug!("{res:?}");