From bb7eaf5c0dc7b416a1f409fac5f6af23a376375c Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 5 Apr 2024 10:41:10 -0400 Subject: [PATCH 1/4] entry: fix clippy::unused_imports finding ``` warning: the item `ptr` is imported redundantly --> src/entry.rs:1146:9 | 1145 | use super::*; | -------- the item `ptr` is already imported here 1146 | use core::ptr; | ^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default ``` --- rustls-libssl/src/entry.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rustls-libssl/src/entry.rs b/rustls-libssl/src/entry.rs index 8f16f68..63d9113 100644 --- a/rustls-libssl/src/entry.rs +++ b/rustls-libssl/src/entry.rs @@ -1143,7 +1143,6 @@ entry_stub! { #[cfg(test)] mod tests { use super::*; - use core::ptr; #[test] fn test_SSL_CTX_new_null() { From e8cbc40ac2f9aed6778d10e9fcf6f7ca8d814a03 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 5 Apr 2024 10:48:50 -0400 Subject: [PATCH 2/4] tests: fix clippy::needless_borrows_for_generic_args ``` error: the borrowed expression implements the required traits --> tests/runner.rs:20:19 | 20 | .args(&[ | ___________________^ 21 | | "s_server", 22 | | "-cert", 23 | | "test-ca/rsa/end.cert", ... | 32 | | "-rev", 33 | | ]) | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args = note: `-D clippy::needless-borrows-for-generic-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrows_for_generic_args)]` ``` --- rustls-libssl/tests/runner.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/rustls-libssl/tests/runner.rs b/rustls-libssl/tests/runner.rs index e295859..0c83b67 100644 --- a/rustls-libssl/tests/runner.rs +++ b/rustls-libssl/tests/runner.rs @@ -32,7 +32,7 @@ use std::{net, thread, time}; fn client() { let _server = KillOnDrop( Command::new("openssl") - .args(&[ + .args([ "s_server", "-cert", "test-ca/rsa/end.cert", @@ -55,14 +55,14 @@ fn client() { let openssl_insecure_output = Command::new("tests/maybe-valgrind.sh") .env("LD_LIBRARY_PATH", "") - .args(&["target/client", "localhost", "4443", "insecure"]) + .args(["target/client", "localhost", "4443", "insecure"]) .stdout(Stdio::piped()) .output() .map(print_output) .unwrap(); let rustls_insecure_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/client", "localhost", "4443", "insecure"]) + .args(["target/client", "localhost", "4443", "insecure"]) .stdout(Stdio::piped()) .output() .map(print_output) @@ -72,14 +72,14 @@ fn client() { let openssl_secure_output = Command::new("tests/maybe-valgrind.sh") .env("LD_LIBRARY_PATH", "") - .args(&["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"]) + .args(["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"]) .stdout(Stdio::piped()) .output() .map(print_output) .unwrap(); let rustls_secure_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"]) + .args(["target/client", "localhost", "4443", "test-ca/rsa/ca.cert"]) .stdout(Stdio::piped()) .output() .map(print_output) @@ -94,7 +94,7 @@ fn client_real_world() { let openssl_output = Command::new("tests/maybe-valgrind.sh") .env("LD_LIBRARY_PATH", "") .env("NO_ECHO", "1") - .args(&["target/client", "example.com", "443", "default"]) + .args(["target/client", "example.com", "443", "default"]) .stdout(Stdio::piped()) .output() .map(print_output) @@ -102,7 +102,7 @@ fn client_real_world() { let rustls_output = Command::new("tests/maybe-valgrind.sh") .env("NO_ECHO", "1") - .args(&["target/client", "example.com", "443", "default"]) + .args(["target/client", "example.com", "443", "default"]) .stdout(Stdio::piped()) .output() .map(print_output) @@ -115,7 +115,7 @@ fn client_real_world() { #[ignore] fn constants() { let openssl_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/constants"]) + .args(["target/constants"]) .env("LD_LIBRARY_PATH", "") .stdout(Stdio::piped()) .output() @@ -123,7 +123,7 @@ fn constants() { .unwrap(); let rustls_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/constants"]) + .args(["target/constants"]) .stdout(Stdio::piped()) .output() .map(print_output) @@ -136,7 +136,7 @@ fn constants() { #[ignore] fn ciphers() { let openssl_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/ciphers"]) + .args(["target/ciphers"]) .env("LD_LIBRARY_PATH", "") .stdout(Stdio::piped()) .output() @@ -144,7 +144,7 @@ fn ciphers() { .unwrap(); let rustls_output = Command::new("tests/maybe-valgrind.sh") - .args(&["target/ciphers"]) + .args(["target/ciphers"]) .stdout(Stdio::piped()) .output() .map(print_output) From 57c99dd5cf65aa8c17e2b9d18fa80d0463a6acb1 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 5 Apr 2024 10:41:29 -0400 Subject: [PATCH 3/4] Makefile: use CARGOFLAGS for test --- rustls-libssl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rustls-libssl/Makefile b/rustls-libssl/Makefile index 3170ba1..8c6a5ab 100644 --- a/rustls-libssl/Makefile +++ b/rustls-libssl/Makefile @@ -22,10 +22,10 @@ endif all: target/ciphers target/client target/constants target/$(PROFILE)/libssl.so.3 test: all - ${CARGO} test --locked + ${CARGO} test $(CARGOFLAGS) integration: all - ${CARGO} test --locked -- --ignored + ${CARGO} test $(CARGOFLAGS) -- --ignored target: mkdir -p $@ From d356b776ac46fd2bcdf314bce623e391a746635f Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 5 Apr 2024 10:49:46 -0400 Subject: [PATCH 4/4] ci: add --all-targets to clippy jobs This ensures we lint test code as well. --- .github/workflows/libssl.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/libssl.yaml b/.github/workflows/libssl.yaml index c1a10a2..18b73b8 100644 --- a/.github/workflows/libssl.yaml +++ b/.github/workflows/libssl.yaml @@ -117,7 +117,7 @@ jobs: # (below) will have a new lint that we want to suppress. # If we suppress (e.g. #![allow(clippy::arc_with_non_send_sync)]), # we would get an unknown-lint error from older clippy versions. - run: cargo clippy --locked --workspace -- -D warnings -A unknown-lints + run: cargo clippy --locked --workspace --all-targets -- -D warnings -A unknown-lints clippy-nightly-optional: name: Clippy nightly (optional) @@ -132,7 +132,7 @@ jobs: with: components: clippy - name: Check clippy - run: cargo clippy --locked --workspace -- -D warnings + run: cargo clippy --locked --workspace --all-targets -- -D warnings clang-tidy: name: Clang Tidy