Skip to content

Commit b2a0bf2

Browse files
committed
Fix latent clippy lints surfaced by --all-targets on illumos
cargo clippy --all-targets -- -D warnings fails on illumos (where the cfg(target_os) build-script lines and the unittest build path compile) on lints the ubuntu CI run never sees: uninlined format args in build.rs and a needless Ok(..?) wrapper, plus roots.len() < 1 in both examples. Inline the format args, drop the wrapper, and use is_empty(). No behavior change.
1 parent 7e715cc commit b2a0bf2

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

tls/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ where
2424
{
2525
let mock = R::load(input)?;
2626
let log = mock.to_bytes()?;
27-
Ok(std::fs::write(output, &log).with_context(|| {
28-
format!("write mock measurement log to file: {}", output)
29-
})?)
27+
std::fs::write(output, &log).with_context(|| {
28+
format!("write mock measurement log to file: {output}")
29+
})
3030
}
3131

3232
/// Execute one of the `attest-mock` commands to generate attestation
3333
/// artifacts used in testing.
3434
fn main() -> Result<()> {
3535
#[cfg(target_os = "illumos")]
3636
{
37-
println!("cargo:rustc-link-arg=-Wl,-R{}", OXIDE_PLATFORM);
38-
println!("cargo:rustc-link-search={}", OXIDE_PLATFORM);
37+
println!("cargo:rustc-link-arg=-Wl,-R{OXIDE_PLATFORM}");
38+
println!("cargo:rustc-link-search={OXIDE_PLATFORM}");
3939
}
4040

4141
#[cfg(feature = "unittest")]
@@ -51,7 +51,7 @@ fn main() -> Result<()> {
5151
let config_path = "test-keys/config.kdl";
5252
let doc =
5353
config::load_and_validate(config_path.as_ref()).map_err(|e| {
54-
anyhow!("Loading config from \"{}\" failed: {e:?}", config_path)
54+
anyhow!("Loading config from \"{config_path}\" failed: {e:?}")
5555
})?;
5656

5757
doc.write_key_pairs(outdir.clone(), OutputFileExistsBehavior::Skip)

tls/examples/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn main() {
6060

6161
let args = Args::parse();
6262

63-
if args.roots.len() < 1 {
63+
if args.roots.is_empty() {
6464
panic!("Need at least one root");
6565
}
6666

tls/examples/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async fn main() {
5959

6060
let args = Args::parse();
6161

62-
if args.roots.len() < 1 {
62+
if args.roots.is_empty() {
6363
panic!("Must specify at least one root");
6464
}
6565

0 commit comments

Comments
 (0)