From 327cc8d7d663d680a56c1132534f4a68df42addc Mon Sep 17 00:00:00 2001 From: Ionut Mihalcea Date: Wed, 13 Sep 2023 16:43:44 +0100 Subject: [PATCH] Bump MSRV and fix clippy lints Bumping MSRV to 1.60.0 as required for the picky-asn1 crate. Also setting the MSRV for clippy and fixing some of the remaining warnings. Some of the things clippy complains about for newer versions of the compiler can be fixed/changed without losing support for older compiler versions, but some features are incompatible. Since clippy is now configured to understand the MSRV, there's also no need for some of the `allow` attributes. Signed-off-by: Ionut Mihalcea --- .clippy.toml | 1 + .github/workflows/ci.yml | 2 +- tss-esapi-sys/build.rs | 1 - tss-esapi/Cargo.toml | 4 ++-- tss-esapi/src/tcti_ldr.rs | 1 - .../tests/integration_tests/abstraction_tests/pcr_tests.rs | 2 +- tss-esapi/tests/integration_tests/main.rs | 1 - .../lists_tests/algorithm_property_list_tests.rs | 4 ++-- .../structures_tests/lists_tests/command_code_list_tests.rs | 4 ++-- 9 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 .clippy.toml diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 00000000..59d02545 --- /dev/null +++ b/.clippy.toml @@ -0,0 +1 @@ +msrv = "1.60.0" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afbe61f9..c996013e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Build the container run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu - name: Run the container - run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env RUST_TOOLCHAIN_VERSION=1.57.0 ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/all-ubuntu.sh + run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --env RUST_TOOLCHAIN_VERSION=1.60.0 ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/all-ubuntu.sh # All in one job as I think it is a big overhead to build and run the Docker # container? tests-ubuntu: diff --git a/tss-esapi-sys/build.rs b/tss-esapi-sys/build.rs index 25530d27..1ab75d82 100644 --- a/tss-esapi-sys/build.rs +++ b/tss-esapi-sys/build.rs @@ -57,7 +57,6 @@ fn main() { } } -#[allow(clippy::uninlined_format_args)] #[cfg(feature = "generate-bindings")] pub fn generate_from_system(esapi_out: PathBuf) { pkg_config::Config::new() diff --git a/tss-esapi/Cargo.toml b/tss-esapi/Cargo.toml index 6c3c7ecf..427c2437 100644 --- a/tss-esapi/Cargo.toml +++ b/tss-esapi/Cargo.toml @@ -24,8 +24,8 @@ regex = "1.3.9" zeroize = { version = "1.1.0", features = ["zeroize_derive"] } tss-esapi-sys = { path = "../tss-esapi-sys", version = "0.4.0" } oid = "0.2.1" -picky-asn1 = "0.7.2" -picky-asn1-x509 = "0.11.0" +picky-asn1 = "0.5.0" +picky-asn1-x509 = "0.7.1" [dev-dependencies] env_logger = "0.9.0" diff --git a/tss-esapi/src/tcti_ldr.rs b/tss-esapi/src/tcti_ldr.rs index 4ca2600b..5e62e719 100644 --- a/tss-esapi/src/tcti_ldr.rs +++ b/tss-esapi/src/tcti_ldr.rs @@ -166,7 +166,6 @@ impl TctiNameConf { } } -#[allow(clippy::uninlined_format_args)] impl TryFrom for CString { type Error = Error; diff --git a/tss-esapi/tests/integration_tests/abstraction_tests/pcr_tests.rs b/tss-esapi/tests/integration_tests/abstraction_tests/pcr_tests.rs index 33aa7280..296eff3d 100644 --- a/tss-esapi/tests/integration_tests/abstraction_tests/pcr_tests.rs +++ b/tss-esapi/tests/integration_tests/abstraction_tests/pcr_tests.rs @@ -119,7 +119,7 @@ fn test_pcr_read_all() { ) .expect("Call 3 to pcr_read failed"); - vec![read_pcrs_1, read_pcrs_2, read_pcrs_3] + [read_pcrs_1, read_pcrs_2, read_pcrs_3] .iter() .enumerate() .for_each(|(idx, dl)| { diff --git a/tss-esapi/tests/integration_tests/main.rs b/tss-esapi/tests/integration_tests/main.rs index b9d63fbd..90e78604 100644 --- a/tss-esapi/tests/integration_tests/main.rs +++ b/tss-esapi/tests/integration_tests/main.rs @@ -1,6 +1,5 @@ // Copyright 2021 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 -#![allow(clippy::uninlined_format_args)] #[path = "common/mod.rs"] mod common; diff --git a/tss-esapi/tests/integration_tests/structures_tests/lists_tests/algorithm_property_list_tests.rs b/tss-esapi/tests/integration_tests/structures_tests/lists_tests/algorithm_property_list_tests.rs index 0e0168a1..abe40280 100644 --- a/tss-esapi/tests/integration_tests/structures_tests/lists_tests/algorithm_property_list_tests.rs +++ b/tss-esapi/tests/integration_tests/structures_tests/lists_tests/algorithm_property_list_tests.rs @@ -13,7 +13,7 @@ use std::convert::{TryFrom, TryInto}; #[test] fn test_conversions() { - let expected_algorithm_properties = vec![ + let expected_algorithm_properties = [ (AlgorithmIdentifier::Rsa, AlgorithmAttributes(1)), (AlgorithmIdentifier::Aes, AlgorithmAttributes(2)), ]; @@ -61,7 +61,7 @@ fn test_conversions() { #[test] fn test_valid_conversion_vector() { - let expected_algorithm_properties = vec![ + let expected_algorithm_properties = [ (AlgorithmIdentifier::Rsa, AlgorithmAttributes(1)), (AlgorithmIdentifier::Aes, AlgorithmAttributes(2)), ]; diff --git a/tss-esapi/tests/integration_tests/structures_tests/lists_tests/command_code_list_tests.rs b/tss-esapi/tests/integration_tests/structures_tests/lists_tests/command_code_list_tests.rs index db99fd65..9474d85c 100644 --- a/tss-esapi/tests/integration_tests/structures_tests/lists_tests/command_code_list_tests.rs +++ b/tss-esapi/tests/integration_tests/structures_tests/lists_tests/command_code_list_tests.rs @@ -12,7 +12,7 @@ use std::convert::{TryFrom, TryInto}; #[test] fn test_conversions() { - let expected_command_codes = vec![ + let expected_command_codes = [ CommandCode::ChangeEps, CommandCode::ChangePps, CommandCode::Clear, @@ -83,7 +83,7 @@ fn test_conversions() { #[test] fn test_valid_conversion_vector() { - let expected_command_codes = vec![ + let expected_command_codes = [ CommandCode::ChangeEps, CommandCode::ChangePps, CommandCode::Clear,