Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Nov 6, 2023
1 parent b047717 commit 3cc869c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions bootstore/src/schemes/v0/peer_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions package/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions package/src/bin/omicron-package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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::<String>();
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() {
Expand Down
4 changes: 2 additions & 2 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_) => {
Expand Down Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/src/zone_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down

0 comments on commit 3cc869c

Please sign in to comment.