From 5f1f8ce1b72627f69bddc3b8087743d8affc2d8b Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Mon, 22 Jan 2024 16:54:45 +0100 Subject: [PATCH] Fixes from clippy --- src/origin/git_proxy.rs | 12 ++++++------ src/service/gemini.rs | 2 +- src/service/http.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/origin/git_proxy.rs b/src/origin/git_proxy.rs index bb64624..8da8387 100644 --- a/src/origin/git_proxy.rs +++ b/src/origin/git_proxy.rs @@ -60,10 +60,10 @@ impl Proxy { &self, descr: &origin::Descr, ) -> Result { - let (url, branch_name) = Self::deconstruct_descr(&descr); + let (url, branch_name) = Self::deconstruct_descr(descr); let refs_url = - Self::construct_url(&url, "/info/refs").or_unexpected_while("constructing refs url")?; + Self::construct_url(url, "/info/refs").or_unexpected_while("constructing refs url")?; // when fetching refs we assume that any issue indicates that the origin itself // (and therefore the URL) has some kind of issue. @@ -103,10 +103,10 @@ impl Proxy { commit_hash: &gix_hash::ObjectId, ) -> Result { let hex = commit_hash.to_string(); - let (url, _) = Self::deconstruct_descr(&descr); + let (url, _) = Self::deconstruct_descr(descr); let commit_object_url = Self::construct_url( - &url, + url, format!("/objects/{}/{}", &hex[..2], &hex[2..]).as_str(), ) .or_unexpected_while("constructing refs url")?; @@ -152,7 +152,7 @@ impl origin::Store for Proxy { // perform the rest of the work within this closure, so we can be sure that the guard // lock is released no matter what. - let res: Result<(), origin::SyncError> = (|| async { + let res = async { let commit_hash = self.get_tip_commit_hash(&descr).await?; let current_tree = self.get_commit_tree(&descr, &commit_hash).await?; self.state @@ -160,7 +160,7 @@ impl origin::Store for Proxy { .unwrap() .insert(descr.clone(), DescrState { current_tree }); Ok(()) - })() + } .await; self.sync_guard.lock().unwrap().remove(&descr); diff --git a/src/service/gemini.rs b/src/service/gemini.rs index 981c94c..434715e 100644 --- a/src/service/gemini.rs +++ b/src/service/gemini.rs @@ -117,7 +117,7 @@ impl Service { // redirect so that the path has '/' appended to it, which will cause the server to // check index.gmi within the path on the new page load. let mut path = path.into_owned(); - path.push_str("/"); + path.push('/'); return Ok(self.respond_conn(w, "30", path.as_str(), None).await?); } Err(GetFileError::Unexpected(e)) => return Err(e.into()), diff --git a/src/service/http.rs b/src/service/http.rs index a111b68..5b11168 100644 --- a/src/service/http.rs +++ b/src/service/http.rs @@ -232,7 +232,7 @@ impl Service { // redirect so that the path has '/' appended to it, which will cause the server to // check index.html within the path on the new page load. let mut path = path.into_owned(); - path.push_str("/"); + path.push('/'); self.render_redirect( http::status::StatusCode::TEMPORARY_REDIRECT.into(), path.as_str(),