Fixes from clippy

main
Brian Picciano 3 months ago
parent b60c849a73
commit 5f1f8ce1b7
  1. 12
      src/origin/git_proxy.rs
  2. 2
      src/service/gemini.rs
  3. 2
      src/service/http.rs

@ -60,10 +60,10 @@ impl Proxy {
&self,
descr: &origin::Descr,
) -> 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 =
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<gix_hash::ObjectId, origin::SyncError> {
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);

@ -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()),

@ -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(),

Loading…
Cancel
Save