-
Notifications
You must be signed in to change notification settings - Fork 4
clippy lints #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
clippy lints #75
Conversation
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
jclulow
left a comment
There was a problem hiding this 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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #[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<_>>(); |
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #[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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| error!(log, "worker liveness task error: {:?}", e); | |
| error!(log, "worker liveness task error: {e:?}"); |
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: