Skip to content

Conversation

@lzrd
Copy link

@lzrd lzrd commented Dec 9, 2025

Mostly mechanical fixes: removing needless borrows, adding lifetime annotations, using modern numeric constants (i32::MAX), and suppressing warnings for dropshot-generated dead code.

Notable equivalences:

  • .as_bytes().len() to .len() on String: both return byte count
  • .trim().split_whitespace() to .split_whitespace(): split_whitespace already skips leading/trailing whitespace
  • .into_iter() to .iter() on slices: both yield &T

Mostly mechanical fixes: removing needless borrows, adding lifetime
annotations, using modern numeric constants (i32::MAX), and suppressing
warnings for dropshot-generated dead code.

Notable equivalences:
- .as_bytes().len() to .len() on String: both return byte count
- .trim().split_whitespace() to .split_whitespace(): split_whitespace
  already skips leading/trailing whitespace
- .into_iter() to .iter() on slices: both yield &T
Copy link
Collaborator

@jclulow jclulow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems broadly good! A few nits.

.arg("create")
.arg("-o")
.arg(&format!("mountpoint={}", INPUT_PATH))
.arg(format!("mountpoint={}", INPUT_PATH))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.arg(format!("mountpoint={}", INPUT_PATH))
.arg(format!("mountpoint={INPUT_PATH}"))

* assessed against the actual file size and a partial (206) response will be
* returned, for both GET and HEAD.
*/
#[allow(clippy::too_many_arguments)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[allow(clippy::too_many_arguments)]

I would rather not put these annotations throughout, especially for the more editorial style things like this.


let pb = sys
.ssh_exec("svcs -Ho sta,nsta svc:/site/postboot:default")?;
let t = pb.out.trim().split_whitespace().collect::<Vec<_>>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that is absolutely not how I expect split_whitespace() to work! The fact that it ignores leading and trailing whitespace (and thus potentially misses empty columns!) is ... a choice.

use crate::pipe::*;
use buildomat_common::OutputExt;

#[allow(clippy::wrong_self_convention)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[allow(clippy::wrong_self_convention)]

I would rather just ignore the editorial ones. I don't plan to have strict clippy cleanness block integration, etc.

out.push(set);
std::fs::DirBuilder::new().mode(0o700).recursive(true).create(&out)?;
out.push(&format!("{}.json", file));
out.push(format!("{}.json", file));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out.push(format!("{}.json", file));
out.push(format!("{file}.json"));

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));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tb.env("GITHUB_REF", format!("refs/heads/{}", branch));
tb.env("GITHUB_REF", format!("refs/heads/{branch}"));

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error!(log, "worker liveness task error: {:?}", e);
error!(log, "worker liveness task error: {e:?}");

@jclulow jclulow changed the title Fix clippy warnings clippy lints Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants