Fixes from clippy

This commit is contained in:
Brian Picciano 2024-01-22 16:54:45 +01:00
parent b60c849a73
commit 5f1f8ce1b7
3 changed files with 8 additions and 8 deletions

View File

@ -60,10 +60,10 @@ impl Proxy {
&self, &self,
descr: &origin::Descr, descr: &origin::Descr,
) -> Result<gix_hash::ObjectId, origin::SyncError> { ) -> Result<gix_hash::ObjectId, origin::SyncError> {
let (url, branch_name) = Self::deconstruct_descr(&descr); let (url, branch_name) = Self::deconstruct_descr(descr);
let refs_url = 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 // when fetching refs we assume that any issue indicates that the origin itself
// (and therefore the URL) has some kind of issue. // (and therefore the URL) has some kind of issue.
@ -103,10 +103,10 @@ impl Proxy {
commit_hash: &gix_hash::ObjectId, commit_hash: &gix_hash::ObjectId,
) -> Result<gix_hash::ObjectId, origin::SyncError> { ) -> Result<gix_hash::ObjectId, origin::SyncError> {
let hex = commit_hash.to_string(); 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( let commit_object_url = Self::construct_url(
&url, url,
format!("/objects/{}/{}", &hex[..2], &hex[2..]).as_str(), format!("/objects/{}/{}", &hex[..2], &hex[2..]).as_str(),
) )
.or_unexpected_while("constructing refs url")?; .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 // perform the rest of the work within this closure, so we can be sure that the guard
// lock is released no matter what. // 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 commit_hash = self.get_tip_commit_hash(&descr).await?;
let current_tree = self.get_commit_tree(&descr, &commit_hash).await?; let current_tree = self.get_commit_tree(&descr, &commit_hash).await?;
self.state self.state
@ -160,7 +160,7 @@ impl origin::Store for Proxy {
.unwrap() .unwrap()
.insert(descr.clone(), DescrState { current_tree }); .insert(descr.clone(), DescrState { current_tree });
Ok(()) Ok(())
})() }
.await; .await;
self.sync_guard.lock().unwrap().remove(&descr); self.sync_guard.lock().unwrap().remove(&descr);

View File

@ -117,7 +117,7 @@ impl Service {
// redirect so that the path has '/' appended to it, which will cause the server to // 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. // check index.gmi within the path on the new page load.
let mut path = path.into_owned(); let mut path = path.into_owned();
path.push_str("/"); path.push('/');
return Ok(self.respond_conn(w, "30", path.as_str(), None).await?); return Ok(self.respond_conn(w, "30", path.as_str(), None).await?);
} }
Err(GetFileError::Unexpected(e)) => return Err(e.into()), Err(GetFileError::Unexpected(e)) => return Err(e.into()),

View File

@ -232,7 +232,7 @@ impl Service {
// redirect so that the path has '/' appended to it, which will cause the server to // 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. // check index.html within the path on the new page load.
let mut path = path.into_owned(); let mut path = path.into_owned();
path.push_str("/"); path.push('/');
self.render_redirect( self.render_redirect(
http::status::StatusCode::TEMPORARY_REDIRECT.into(), http::status::StatusCode::TEMPORARY_REDIRECT.into(),
path.as_str(), path.as_str(),