diff --git a/Cargo.lock b/Cargo.lock index a7aa3aa153..0e1d65b273 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5234,6 +5234,7 @@ dependencies = [ "slog-term", "smf", "strum", + "swrite", "tar", "tempfile", "thiserror", @@ -8713,6 +8714,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "swrite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f3fece30b2dc06d65ecbca97b602db15bf75f932711d60cc604534f1f8b7a03" + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index 8aaae347d5..d1bd35097c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -345,6 +345,7 @@ static_assertions = "1.1.0" steno = "0.4.0" strum = { version = "0.25", features = [ "derive" ] } subprocess = "0.2.9" +swrite = "0.1.0" libsw = { version = "3.3.0", features = ["tokio"] } syn = { version = "2.0" } tabled = "0.14" diff --git a/bootstore/src/schemes/v0/peer_networking.rs b/bootstore/src/schemes/v0/peer_networking.rs index acde14d085..33673cdab8 100644 --- a/bootstore/src/schemes/v0/peer_networking.rs +++ b/bootstore/src/schemes/v0/peer_networking.rs @@ -643,6 +643,9 @@ async fn perform_handshake( let end = INITIAL_READ + identify_len; + // Clippy for Rust 1.73 warns on this but there doesn't seem to be a + // better way to write it? + #[allow(clippy::unnecessary_unwrap)] if identify.is_some() && !out_cursor.has_remaining() { return Ok((read_sock, write_sock, identify.unwrap())); } diff --git a/nexus/db-queries/src/db/datastore/inventory.rs b/nexus/db-queries/src/db/datastore/inventory.rs index 6b7d97754a..114b9dbe31 100644 --- a/nexus/db-queries/src/db/datastore/inventory.rs +++ b/nexus/db-queries/src/db/datastore/inventory.rs @@ -685,7 +685,7 @@ impl DataStore { .rev() .find(|(_i, (_collection_id, nerrors))| *nerrors == 0); let candidate = match last_completed_idx { - Some((i, _)) if i == 0 => candidates.iter().skip(1).next(), + Some((0, _)) => candidates.iter().skip(1).next(), _ => candidates.iter().next(), } .map(|(collection_id, _nerrors)| *collection_id); diff --git a/package/Cargo.toml b/package/Cargo.toml index b840938db0..9bf0b37a23 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -27,6 +27,7 @@ slog-async.workspace = true slog-term.workspace = true smf.workspace = true strum.workspace = true +swrite.workspace = true tar.workspace = true tempfile.workspace = true thiserror.workspace = true diff --git a/package/src/bin/omicron-package.rs b/package/src/bin/omicron-package.rs index bc07b61234..357a217fe5 100644 --- a/package/src/bin/omicron-package.rs +++ b/package/src/bin/omicron-package.rs @@ -29,6 +29,7 @@ use std::io::Write; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::Arc; +use swrite::{swrite, SWrite}; use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader}; use tokio::process::Command; @@ -153,12 +154,11 @@ async fn do_for_all_rust_packages( }) .partition(|(_, release)| *release); - let features = config - .target - .0 - .iter() - .map(|(name, value)| format!("{}-{} ", name, value)) - .collect::(); + let features = + config.target.0.iter().fold(String::new(), |mut acc, (name, value)| { + swrite!(acc, "{}-{} ", name, value); + acc + }); // Execute all the release / debug packages at the same time. if !release_pkgs.is_empty() { diff --git a/sled-agent/src/sled_agent.rs b/sled-agent/src/sled_agent.rs index 52513f081d..6655a732a0 100644 --- a/sled-agent/src/sled_agent.rs +++ b/sled-agent/src/sled_agent.rs @@ -299,7 +299,7 @@ impl SledAgent { sz, )?; } - Some(sz) if sz == 0 => { + Some(0) => { panic!("Invalid requested swap device size of 0 GiB"); } None | Some(_) => { @@ -375,7 +375,7 @@ impl SledAgent { e })?; } - Some(sz) if sz == 0 => { + Some(0) => { warn!(log, "Not using VMM reservoir (size 0 bytes requested)"); } None => { diff --git a/sled-agent/src/zone_bundle.rs b/sled-agent/src/zone_bundle.rs index 55661371c3..91cb850df4 100644 --- a/sled-agent/src/zone_bundle.rs +++ b/sled-agent/src/zone_bundle.rs @@ -904,7 +904,7 @@ async fn find_service_log_files( if path != current_log_file && path_ref.starts_with(current_log_file_ref) { - log_files.push(path.clone().into()); + log_files.push(path.into()); } }