From 9ef34890faadd9ab4e74ddf22a19e6254b762a5f Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 28 Aug 2023 03:23:30 +0000 Subject: [PATCH] chore: fix beta clippy warnings --- src/job.rs | 6 +++--- src/quota.rs | 2 +- src/webxdc.rs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/job.rs b/src/job.rs index f739f4f63..d1ae367ea 100644 --- a/src/job.rs +++ b/src/job.rs @@ -155,8 +155,8 @@ impl<'a> Connection<'a> { pub(crate) async fn perform_job(context: &Context, mut connection: Connection<'_>, mut job: Job) { info!(context, "Job {} started...", &job); - let try_res = match perform_job_action(context, &mut job, &mut connection, 0).await { - Status::RetryNow => perform_job_action(context, &mut job, &mut connection, 1).await, + let try_res = match perform_job_action(context, &job, &mut connection, 0).await { + Status::RetryNow => perform_job_action(context, &job, &mut connection, 1).await, x => x, }; @@ -205,7 +205,7 @@ pub(crate) async fn perform_job(context: &Context, mut connection: Connection<'_ async fn perform_job_action( context: &Context, - job: &mut Job, + job: &Job, connection: &mut Connection<'_>, tries: u32, ) -> Status { diff --git a/src/quota.rs b/src/quota.rs index cc3f428fd..f2a4b921d 100644 --- a/src/quota.rs +++ b/src/quota.rs @@ -71,7 +71,7 @@ async fn get_unique_quota_roots_and_usage( // messages could be received and so the usage could have been changed *unique_quota_roots .entry(quota_root_name.clone()) - .or_insert_with(Vec::new) = quota.resources; + .or_default() = quota.resources; } } } diff --git a/src/webxdc.rs b/src/webxdc.rs index a622e41e5..46ada2fab 100644 --- a/src/webxdc.rs +++ b/src/webxdc.rs @@ -707,7 +707,7 @@ fn parse_webxdc_manifest(bytes: &[u8]) -> Result { Ok(manifest) } -async fn get_blob(archive: &mut async_zip::read::fs::ZipFileReader, name: &str) -> Result> { +async fn get_blob(archive: &async_zip::read::fs::ZipFileReader, name: &str) -> Result> { let (i, _) = find_zip_entry(archive.file(), name) .ok_or_else(|| anyhow!("no entry found for {}", name))?; let mut reader = archive.entry(i).await?; @@ -750,10 +750,10 @@ impl Message { name }; - let mut archive = self.get_webxdc_archive(context).await?; + let archive = self.get_webxdc_archive(context).await?; if name == "index.html" { - if let Ok(bytes) = get_blob(&mut archive, "manifest.toml").await { + if let Ok(bytes) = get_blob(&archive, "manifest.toml").await { if let Ok(manifest) = parse_webxdc_manifest(&bytes) { if let Some(min_api) = manifest.min_api { if min_api > WEBXDC_API_VERSION { @@ -766,15 +766,15 @@ impl Message { } } - get_blob(&mut archive, name).await + get_blob(&archive, name).await } /// Return info from manifest.toml or from fallbacks. pub async fn get_webxdc_info(&self, context: &Context) -> Result { ensure!(self.viewtype == Viewtype::Webxdc, "No webxdc instance."); - let mut archive = self.get_webxdc_archive(context).await?; + let archive = self.get_webxdc_archive(context).await?; - let mut manifest = get_blob(&mut archive, "manifest.toml") + let mut manifest = get_blob(&archive, "manifest.toml") .await .map(|bytes| parse_webxdc_manifest(&bytes).unwrap_or_default()) .unwrap_or_default();