diff --git a/Cargo.toml b/Cargo.toml index 0a77a5f..c723433 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,10 @@ members = [ ] resolver = "2" +[workspace.lints.clippy] +too_many_arguments = "allow" +wrong_self_convention = "allow" + [workspace.dependencies] ansi-to-html = { version = "0.2", features = [ "lazy-init" ] } anyhow = "1" diff --git a/agent/src/control/mod.rs b/agent/src/control/mod.rs index b26493a..832f4de 100644 --- a/agent/src/control/mod.rs +++ b/agent/src/control/mod.rs @@ -178,13 +178,13 @@ async fn cmd_address_list(mut l: Level) -> Result<()> { let mut r = Row::default(); r.add_str("name", &addr.name); - r.add_str("cidr", &net.to_string()); - r.add_str("first", &first.to_string()); - r.add_str("last", &last.to_string()); + r.add_str("cidr", net.to_string()); + r.add_str("first", first.to_string()); + r.add_str("last", last.to_string()); r.add_u64("count", addr.count.into()); r.add_str("family", "inet"); - r.add_str("network", &net.network().to_string()); - r.add_str("mask", &net.netmask().to_string()); + r.add_str("network", net.network().to_string()); + r.add_str("mask", net.netmask().to_string()); r.add_str("routed", if addr.routed { "yes" } else { "no" }); r.add_str("gateway", addr.gateway.as_deref().unwrap_or("-")); diff --git a/agent/src/exec.rs b/agent/src/exec.rs index 6a82677..e7c8184 100644 --- a/agent/src/exec.rs +++ b/agent/src/exec.rs @@ -23,10 +23,7 @@ fn spawn_reader( where T: Read + Send + 'static, { - let stream = match stream { - Some(stream) => stream, - None => return None, - }; + let stream = stream?; Some(std::thread::spawn(move || { let mut r = BufReader::new(stream); @@ -297,7 +294,7 @@ fn run_common( * process. */ if ab.bgproc.is_none() { - tx.blocking_send(ab.exit(&start, &end, std::i32::MAX)) + tx.blocking_send(ab.exit(&start, &end, i32::MAX)) .unwrap(); } @@ -332,7 +329,7 @@ fn run_common( let code = if let Some(code) = es.code() { code } else { - std::i32::MAX + i32::MAX }; tx.blocking_send(ab.exit(&start, &end, code)).unwrap(); stdio_warning diff --git a/agent/src/main.rs b/agent/src/main.rs index 4705440..5866ee1 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -1093,7 +1093,7 @@ async fn cmd_install(mut l: Level) -> Result<()> { let status = Command::new("/sbin/zfs") .arg("create") .arg("-o") - .arg(&format!("mountpoint={}", INPUT_PATH)) + .arg(format!("mountpoint={INPUT_PATH}")) .arg(INPUT_DATASET) .env_clear() .current_dir("/") diff --git a/bin/src/main.rs b/bin/src/main.rs index 71b340c..ad7a5d5 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -26,11 +26,11 @@ mod config; trait FlagsExt { #[must_use] - fn add_flags(&mut self, name: &'static str) -> Flags; + fn add_flags(&mut self, name: &'static str) -> Flags<'_>; } impl FlagsExt for Row { - fn add_flags(&mut self, name: &'static str) -> Flags { + fn add_flags(&mut self, name: &'static str) -> Flags<'_> { Flags { row: self, name, out: String::new() } } } @@ -1226,7 +1226,7 @@ async fn do_job_store_list(mut l: Level) -> Result<()> { ); r.add_str( "updated", - &ent.time_update.to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + ent.time_update.to_rfc3339_opts(chrono::SecondsFormat::Secs, true), ); t.add_row(r); @@ -1351,7 +1351,7 @@ async fn do_user_list(mut l: Level) -> Result<()> { r.add_str("name", &u.name); r.add_str( "creation", - &u.time_create.to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + u.time_create.to_rfc3339_opts(chrono::SecondsFormat::Secs, true), ); r.add_age("age", u.time_create.age()); t.add_row(r); diff --git a/download/Cargo.toml b/download/Cargo.toml index fba1796..6a0c8a0 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -4,6 +4,9 @@ version = "0.0.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [lib] doctest = false diff --git a/download/src/lib.rs b/download/src/lib.rs index 5a5ec4b..03c3e55 100644 --- a/download/src/lib.rs +++ b/download/src/lib.rs @@ -43,7 +43,7 @@ fn make_get_response( rx: mpsc::Receiver, E>>, ) -> Result> where - E: Into> + E: Into> + Send + Sync + 'static, diff --git a/factory/aws/src/aws.rs b/factory/aws/src/aws.rs index 237d34f..f455dcd 100644 --- a/factory/aws/src/aws.rs +++ b/factory/aws/src/aws.rs @@ -70,7 +70,7 @@ impl Instance { .try_into() .unwrap(); - (if when <= now { now - when } else { 0 }) / 1000 + now.saturating_sub(when) / 1000 }) .unwrap_or(0) } @@ -188,7 +188,7 @@ async fn create_instance( let mut instances = res .instances() - .into_iter() + .iter() .map(|i| Instance::from((i, config.aws.tag.as_str()))) .collect::>(); @@ -218,13 +218,12 @@ async fn instances( Ok(res .reservations() .iter() - .map(|r| { + .flat_map(|r| { r.instances().iter().map(|i| { let i = Instance::from((i, tag)); (i.id.to_string(), i) }) }) - .flatten() .collect()) } @@ -421,7 +420,7 @@ async fn aws_worker_one( * There is a record of a particular instance ID for this worker. * Check to see if that instance exists. */ - if let Some(i) = insts.get(&instance_id.to_string()) { + if let Some(i) = insts.get(instance_id) { if i.state == "terminated" { /* * The instance exists, but is terminated. Delete the diff --git a/factory/aws/src/main.rs b/factory/aws/src/main.rs index 4c7c96c..f3a510d 100644 --- a/factory/aws/src/main.rs +++ b/factory/aws/src/main.rs @@ -72,7 +72,7 @@ impl Central { * Allow the per-target diagnostic configuration to override the base * diagnostic configuration. */ - Ok(self.config.diag.apply_overrides(&t.diag).build()?) + self.config.diag.apply_overrides(&t.diag).build() } } diff --git a/factory/gimlet/Cargo.toml b/factory/gimlet/Cargo.toml index 2d0858d..d4e14ce 100644 --- a/factory/gimlet/Cargo.toml +++ b/factory/gimlet/Cargo.toml @@ -4,6 +4,9 @@ version = "0.0.0" edition = "2021" license = "MPL-2.0" +[lints] +workspace = true + [dependencies] buildomat-common = { path = "../../common" } buildomat-database = { path = "../../database" } diff --git a/factory/gimlet/src/cleanup.rs b/factory/gimlet/src/cleanup.rs index 2919a57..9eccb3c 100644 --- a/factory/gimlet/src/cleanup.rs +++ b/factory/gimlet/src/cleanup.rs @@ -110,7 +110,7 @@ pub fn setup() -> Result<()> { bail!("giving up after {MAX_TIME} seconds"); } - if let Ok(st) = svcs(&fmri) { + if let Ok(st) = svcs(fmri) { if st.next.is_none() && st.current == "ON" { println!(" * {fmri} now online!"); break; @@ -125,7 +125,7 @@ pub fn setup() -> Result<()> { * only be one! */ let pools = zpool_unimported_list()?; - if pools.len() == 0 { + if pools.is_empty() { bail!("no unimported pool found!"); } else if pools.len() > 1 { bail!("more than one unimported pool found!"); @@ -137,14 +137,14 @@ pub fn setup() -> Result<()> { }; println!(" * importing pool {pool:?}..."); - zpool_import(&pool)?; + zpool_import(pool)?; /* * Update the BSU symlink: */ std::fs::create_dir_all("/pool/bsu")?; std::fs::remove_file("/pool/bsu/0").ok(); - std::os::unix::fs::symlink(&format!("../int/{pool_id}"), "/pool/bsu/0")?; + std::os::unix::fs::symlink(format!("../int/{pool_id}"), "/pool/bsu/0")?; /* * Create the swap device: @@ -252,14 +252,14 @@ fn prepare_m2() -> Result<()> { let p = &mut vtoc.parts_mut()[i]; p.p_tag = efi::sys::V_USR; p.p_start = next_start; - p.p_size = size.into(); + p.p_size = size; next_start = next_start.checked_add(size).unwrap(); } /* * Create the dump slice: */ - let size = (1 * 1024 * 1024 * 1024 * 1024) / vtoc.block_size(); + let size = (1024 * 1024 * 1024 * 1024) / vtoc.block_size(); let p = &mut vtoc.parts_mut()[4]; p.p_tag = efi::sys::V_USR; p.p_start = next_start; @@ -287,11 +287,11 @@ fn prepare_m2() -> Result<()> { .env_clear() .arg("create") .arg("-O") - .arg(&format!("mountpoint=/pool/int/{id}")) + .arg(format!("mountpoint=/pool/int/{id}")) .arg("-O") .arg("compress=on") .arg(&pool) - .arg(&format!("{}s5", d.name)) + .arg(format!("{}s5", d.name)) .output()?; if !out.status.success() { diff --git a/factory/gimlet/src/disks.rs b/factory/gimlet/src/disks.rs index c7fe058..d738684 100644 --- a/factory/gimlet/src/disks.rs +++ b/factory/gimlet/src/disks.rs @@ -121,7 +121,7 @@ pub fn list_disks() -> Result { slice: u32| -> Result> { let mut paths = links - .links_for_path(&device)? + .links_for_path(device)? .into_iter() .filter(|l| { l.linktype() == devinfo::DevLinkType::Primary @@ -193,18 +193,18 @@ pub fn list_disks() -> Result { */ let device = m.devfs_path()?; - Ok((0..=8) + (0..=8) .map(|num| { Ok(slice_from_path(&device, num)?.map(|link| { (num, m.spec_type(), link.path().to_owned()) })) }) - .collect::>>()?) + .collect::>>() }) .collect::>>()? .into_iter() .flatten() - .filter_map(|v| v) + .flatten() .collect::>(); /* diff --git a/factory/gimlet/src/host.rs b/factory/gimlet/src/host.rs index 399c987..74cf715 100644 --- a/factory/gimlet/src/host.rs +++ b/factory/gimlet/src/host.rs @@ -624,7 +624,7 @@ impl HostManager { Ok(()) } HostState::Cleaning(cst) => { - let mut new_cst = cst.clone(); + let mut new_cst = *cst; { let mut l = self.locked.lock().unwrap(); @@ -700,7 +700,7 @@ impl HostManager { Ok(()) } HostState::Starting(sst, hgs) => { - let mut new_sst = sst.clone(); + let mut new_sst = *sst; { let mut l = self.locked.lock().unwrap(); @@ -726,7 +726,7 @@ impl HostManager { } } - if let Err(e) = self.thread_starting(&mut new_sst, &hgs) { + if let Err(e) = self.thread_starting(&mut new_sst, hgs) { error!(log, "starting error: {e}"); } @@ -794,7 +794,7 @@ impl HostManager { let pb = sys .ssh_exec("svcs -Ho sta,nsta svc:/site/postboot:default")?; - let t = pb.out.trim().split_whitespace().collect::>(); + let t = pb.out.split_whitespace().collect::>(); if t.len() != 2 || t[0] == "ON" || t[1] == "-" { bail!("postboot not ready: {t:?}"); } @@ -847,7 +847,7 @@ impl HostManager { let pb = sys .ssh_exec("svcs -Ho sta,nsta svc:/site/postboot:default")?; - let t = pb.out.trim().split_whitespace().collect::>(); + let t = pb.out.split_whitespace().collect::>(); if t.len() != 2 || t[0] == "ON" || t[1] == "-" { bail!("postboot not ready: {t:?}"); } diff --git a/factory/gimlet/src/humility.rs b/factory/gimlet/src/humility.rs index ec43267..1611ba8 100644 --- a/factory/gimlet/src/humility.rs +++ b/factory/gimlet/src/humility.rs @@ -57,7 +57,7 @@ impl ValueExt for Value { bail!("expected a hex number, got {t:?}"); }; - out.push(u8::from_str_radix(&hex, 16)?); + out.push(u8::from_str_radix(hex, 16)?); } _ => bail!("list should only contain terms"), } diff --git a/factory/gimlet/src/instance.rs b/factory/gimlet/src/instance.rs index 64a69b1..1580175 100644 --- a/factory/gimlet/src/instance.rs +++ b/factory/gimlet/src/instance.rs @@ -83,7 +83,7 @@ async fn instance_worker_start( } instances_with_workers.insert(id.clone()); - let c = Arc::clone(&c); + let c = Arc::clone(c); let log = log.new(o!( "component" => "instance_worker", "instance" => id.to_string(), diff --git a/factory/lab/src/main.rs b/factory/lab/src/main.rs index 5a7380b..1a31ab4 100644 --- a/factory/lab/src/main.rs +++ b/factory/lab/src/main.rs @@ -2,6 +2,8 @@ * Copyright 2023 Oxide Computer Company */ +#![allow(dead_code)] + use std::{ collections::HashMap, sync::{Arc, Mutex}, diff --git a/factory/lab/src/minder.rs b/factory/lab/src/minder.rs index 5773e2a..98732d0 100644 --- a/factory/lab/src/minder.rs +++ b/factory/lab/src/minder.rs @@ -74,7 +74,7 @@ impl FormatScript { .replace("%BASEURL%", &self.host_config.lab_baseurl) .replace("%HOST%", &self.host_config.nodename) .replace("%CONSOLE%", &self.host_config.console) - .replace("%BOOTARGS%", &bootargs) + .replace("%BOOTARGS%", bootargs) .replace("%COREURL%", &self.coreurl); if let Some(key) = self.key.as_deref() { @@ -149,7 +149,7 @@ impl CentralExt for Central { &self, name: &str, ) -> HResult<&super::config::ConfigFileHost> { - if let Some(h) = self.hosts.get(&name.to_string()) { + if let Some(h) = self.hosts.get(name) { Ok(&h.config) } else { Err(dropshot::HttpError::for_client_error( diff --git a/factory/propolis/src/config.rs b/factory/propolis/src/config.rs index 2bcc1a2..23fbcbf 100644 --- a/factory/propolis/src/config.rs +++ b/factory/propolis/src/config.rs @@ -93,7 +93,7 @@ impl ConfigFile { &self, slot: u32, id: &InstanceId, - ) -> Result { + ) -> Result> { Ok(InstanceInSlot { config: self, slot, id: id.clone() }) } diff --git a/factory/propolis/src/main.rs b/factory/propolis/src/main.rs index 7e0cde2..19873dc 100644 --- a/factory/propolis/src/main.rs +++ b/factory/propolis/src/main.rs @@ -39,7 +39,7 @@ impl Central { * Allow the per-target diagnostic configuration to override the base * diagnostic configuration. */ - Ok(self.config.diag.apply_overrides(&t.diag).build()?) + self.config.diag.apply_overrides(&t.diag).build() } } diff --git a/factory/propolis/src/vm.rs b/factory/propolis/src/vm.rs index 3e25a52..896a51a 100644 --- a/factory/propolis/src/vm.rs +++ b/factory/propolis/src/vm.rs @@ -461,8 +461,8 @@ async fn instance_worker_one( include_str!("../smf/serial.xml"), ), ] { - std::fs::write(&vmdir.join(&format!("{name}.sh")), script)?; - std::fs::write(&smfdir.join(format!("{name}.xml")), bundle)?; + std::fs::write(vmdir.join(format!("{name}.sh")), script)?; + std::fs::write(smfdir.join(format!("{name}.xml")), bundle)?; } std::fs::write(&siteprofile, include_str!("../smf/site.xml"))?; diff --git a/github/database/src/tables/check_suite.rs b/github/database/src/tables/check_suite.rs index 3fd23d9..c538552 100644 --- a/github/database/src/tables/check_suite.rs +++ b/github/database/src/tables/check_suite.rs @@ -61,7 +61,7 @@ impl From for JobFile { content, dependencies: dependencies .into_iter() - .map(|(a, b)| (a.into(), b.into())) + .map(|(a, b)| (a, b.into())) .collect(), } } diff --git a/github/dbtool/src/main.rs b/github/dbtool/src/main.rs index a70b21c..52f4cc3 100644 --- a/github/dbtool/src/main.rs +++ b/github/dbtool/src/main.rs @@ -22,11 +22,11 @@ const SHORT_SHA_LEN: usize = 16; trait FlagsExt { #[must_use] - fn add_flags(&mut self, name: &'static str) -> Flags; + fn add_flags(&mut self, name: &'static str) -> Flags<'_>; } impl FlagsExt for Row { - fn add_flags(&mut self, name: &'static str) -> Flags { + fn add_flags(&mut self, name: &'static str) -> Flags<'_> { Flags { row: self, name, out: String::new() } } } @@ -69,7 +69,7 @@ impl Stuff { std::fs::DirBuilder::new().mode(0o700).recursive(true).create(&out)?; out.push(set); std::fs::DirBuilder::new().mode(0o700).recursive(true).create(&out)?; - out.push(&format!("{}.json", file)); + out.push(format!("{file}.json")); Ok(out) } } @@ -290,7 +290,7 @@ async fn do_delivery_list(mut l: Level) -> Result<()> { ); r.add_str( "ack", - &del.ack.map(|n| n.to_string()).unwrap_or_else(|| "-".to_string()), + del.ack.map(|n| n.to_string()).unwrap_or_else(|| "-".to_string()), ); let seq = del.seq; @@ -371,10 +371,10 @@ async fn do_check_suite_list(mut l: Level) -> Result<()> { for suite in l.context().db().list_check_suites()? { let mut r = Row::default(); - r.add_str("id", &suite.id.to_string()); + r.add_str("id", suite.id.to_string()); r.add_u64("ghid", suite.github_id as u64); r.add_u64("repo", suite.repo as u64); - r.add_str("state", &format!("{:?}", suite.state)); + r.add_str("state", format!("{:?}", suite.state)); r.add_str("ssha", &suite.head_sha[0..SHORT_SHA_LEN]); r.add_str("sha", suite.head_sha); r.add_str("branch", suite.head_branch.as_deref().unwrap_or("-")); @@ -407,14 +407,14 @@ async fn do_check_suite_runs(mut l: Level) -> Result<()> { for run in l.context().db().list_check_runs_for_suite(csid)? { let mut r = Row::default(); - r.add_str("id", &run.id.to_string()); + r.add_str("id", run.id.to_string()); r.add_flags("flags") .flag('A', run.active) .flag('F', run.flushed) .build(); r.add_str("active", if run.active { "yes" } else { "no" }); r.add_str("flushed", if run.flushed { "yes" } else { "no" }); - r.add_str("variety", &run.variety.to_string()); + r.add_str("variety", run.variety.to_string()); r.add_str("name", &run.name); t.add_row(r); diff --git a/github/server/src/http.rs b/github/server/src/http.rs index 2bd1f93..68c9624 100644 --- a/github/server/src/http.rs +++ b/github/server/src/http.rs @@ -359,7 +359,7 @@ async fn details( Ok(hyper::Response::builder() .status(hyper::StatusCode::OK) .header(hyper::header::CONTENT_TYPE, "text/html; charset=utf-8") - .header(hyper::header::CONTENT_LENGTH, out.as_bytes().len()) + .header(hyper::header::CONTENT_LENGTH, out.len()) .body(Body::from(out))?) } @@ -831,7 +831,7 @@ async fn status_impl( Ok(hyper::Response::builder() .status(hyper::StatusCode::OK) .header(hyper::header::CONTENT_TYPE, "text/html; charset=utf-8") - .header(hyper::header::CONTENT_LENGTH, out.as_bytes().len()) + .header(hyper::header::CONTENT_LENGTH, out.len()) .body(Body::from(out))?) } @@ -1020,7 +1020,7 @@ async fn branch_to_commit( Ok(hyper::Response::builder() .status(hyper::StatusCode::OK) .header(hyper::header::CONTENT_TYPE, "text/plain") - .header(hyper::header::CONTENT_LENGTH, body.as_bytes().len()) + .header(hyper::header::CONTENT_LENGTH, body.len()) .body(body.into())?) } diff --git a/github/server/src/main.rs b/github/server/src/main.rs index a274f65..17616fc 100644 --- a/github/server/src/main.rs +++ b/github/server/src/main.rs @@ -3,6 +3,7 @@ */ #![allow(clippy::vec_init_then_push)] +#![allow(dead_code)] use anyhow::{anyhow, bail, Context, Result}; use base64::Engine; @@ -300,7 +301,7 @@ impl App { fn buildomat(&self, repo: &Repository) -> buildomat_client::Client { buildomat_client::ClientBuilder::new(&self.config.buildomat.url) .bearer_token(&self.config.buildomat.token) - .delegated_user(&self.buildomat_username(repo)) + .delegated_user(self.buildomat_username(repo)) .build() .unwrap() } diff --git a/github/server/src/variety/basic.rs b/github/server/src/variety/basic.rs index 750d6bf..c662491 100644 --- a/github/server/src/variety/basic.rs +++ b/github/server/src/variety/basic.rs @@ -678,11 +678,11 @@ pub(crate) async fn run( * We pass several GitHub-specific environment variables to tasks in the * job: */ - tb.env("GITHUB_REPOSITORY", &format!("{}/{}", repo.owner, repo.name)); + tb.env("GITHUB_REPOSITORY", format!("{}/{}", repo.owner, repo.name)); tb.env("GITHUB_SHA", &cs.head_sha); if let Some(branch) = cs.head_branch.as_deref() { tb.env("GITHUB_BRANCH", branch); - tb.env("GITHUB_REF", &format!("refs/heads/{}", branch)); + tb.env("GITHUB_REF", format!("refs/heads/{branch}")); } let app0 = app.clone(); @@ -1046,7 +1046,7 @@ pub(crate) async fn artefact( .header(hyper::header::CONTENT_TYPE, "text/html") .header(hyper::header::CONTENT_LENGTH, md.len()) .body(Body::wrap(StreamBody::new( - stream.map_ok(|b| Frame::data(b)), + stream.map_ok(Frame::data), )))?, )); } @@ -1110,7 +1110,7 @@ pub(crate) async fn artefact( .header(hyper::header::CONTENT_TYPE, ct) .header(hyper::header::CONTENT_LENGTH, cl) .body(Body::wrap(StreamBody::new( - backend.into_inner_stream().map_ok(|b| Frame::data(b)), + backend.into_inner_stream().map_ok(Frame::data), )))?, )); } @@ -1257,7 +1257,7 @@ pub(crate) async fn details( &bm, &job, local_time, - format!("./{}/live", cr.id.to_string()), + format!("./{}/live", cr.id), ) .await?; } diff --git a/jobsh/src/variety/basic.rs b/jobsh/src/variety/basic.rs index 92aec58..a5c32e6 100644 --- a/jobsh/src/variety/basic.rs +++ b/jobsh/src/variety/basic.rs @@ -95,7 +95,7 @@ pub async fn output_table( for ev in page { minseq = ev.seq + 1; - payload_size += ev.payload.as_bytes().len(); + payload_size += ev.payload.len(); events.push(ev); if payload_size > PAYLOAD_SIZE_MAX { diff --git a/server/src/db/mod.rs b/server/src/db/mod.rs index 9c78fb8..8636a6a 100644 --- a/server/src/db/mod.rs +++ b/server/src/db/mod.rs @@ -2361,7 +2361,7 @@ impl Database { */ let max_val_count = 100; let max_val_kib = 10; - if value.as_bytes().len() > max_val_kib * 1024 { + if value.len() > max_val_kib * 1024 { conflict!("maximum value size is {max_val_kib}KiB"); } diff --git a/server/src/main.rs b/server/src/main.rs index dc52d40..d9992c6 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -4,6 +4,7 @@ #![allow(clippy::many_single_char_names)] #![allow(clippy::too_many_arguments)] +#![allow(dead_code)] use std::collections::VecDeque; use std::io::{Seek, Write}; diff --git a/server/src/workers.rs b/server/src/workers.rs index 5fdf69e..48c4f4d 100644 --- a/server/src/workers.rs +++ b/server/src/workers.rs @@ -163,10 +163,8 @@ pub(crate) async fn worker_cleanup(log: Logger, c: Arc) -> Result<()> { info!(log, "starting worker liveness checks"); liveness_checks = true; } - } else { - if let Err(e) = worker_liveness_one(&log, &c).await { - error!(log, "worker liveness task error: {:?}", e); - } + } else if let Err(e) = worker_liveness_one(&log, &c).await { + error!(log, "worker liveness task error: {e:?}"); } tokio::time::sleep(delay).await; diff --git a/sse/src/lib.rs b/sse/src/lib.rs index 7d9b968..d69aa27 100644 --- a/sse/src/lib.rs +++ b/sse/src/lib.rs @@ -111,7 +111,7 @@ impl ServerSentEvents { ))))?) } - pub fn build_event(&self) -> EventBuilder { + pub fn build_event(&self) -> EventBuilder<'_> { EventBuilder { sse: self, id: None, event: None, data: None } }