diff --git a/proto/src/lib.rs b/proto/src/lib.rs index ede040640..0cfb74baa 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -32,11 +32,11 @@ include!("codegen/google.crypto.tink.rs"); #[cfg(feature = "json")] include!("codegen/serde/google.crypto.tink.rs"); +// Manual keyset serialization implementations that map enums onto strings rather than +// the `i32` values used by [prost](https://docs.rs/prost). #[cfg(feature = "json")] #[cfg_attr(docsrs, doc(cfg(feature = "json")))] pub mod json { - //! Manual keyset serialization implementations that map enums onto strings rather than - //! the `i32` values used by [prost](https://docs.rs/prost). pub mod key_status_type { //! Manual JSON serialization for [`KeyStatusType`](crate::KeyStatusType) enums. use serde::Deserialize; diff --git a/signature/src/subtle/ecdsa_signer.rs b/signature/src/subtle/ecdsa_signer.rs index 240734747..53fcff0d1 100644 --- a/signature/src/subtle/ecdsa_signer.rs +++ b/signature/src/subtle/ecdsa_signer.rs @@ -17,7 +17,6 @@ use generic_array::typenum::Unsigned; use p256::elliptic_curve; use signature::RandomizedSigner; -use std::convert::TryInto; use tink_core::{utils::wrap_err, TinkError}; use tink_proto::{EcdsaSignatureEncoding, EllipticCurveType, HashType}; @@ -63,12 +62,8 @@ impl EcdsaSigner { return Err("EcdsaSigner: invalid private key len".into()); } EcdsaPrivateKey::NistP256( - p256::ecdsa::SigningKey::from_bytes( - key_value - .try_into() - .map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?, - ) - .map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?, + p256::ecdsa::SigningKey::from_bytes(key_value.into()) + .map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?, ) } _ => return Err(format!("EcdsaSigner: unsupported curve {curve:?}").into()), diff --git a/testing/src/main.rs b/testing/src/main.rs index 0082b16ce..9574a07c7 100644 --- a/testing/src/main.rs +++ b/testing/src/main.rs @@ -21,9 +21,9 @@ use log::info; use structopt::StructOpt; use tonic::transport::Server; -#[allow(clippy::wrong_self_convention)] pub mod proto { //! Auto-generated code from protocol buffer message and service definitions. + #![allow(clippy::wrong_self_convention)] #![allow(clippy::large_enum_variant)] #![allow(clippy::derive_partial_eq_without_eq)] include!("codegen/tink_testing_api.rs"); diff --git a/tests/src/testdata.rs b/tests/src/testdata.rs index 5da1a18ab..6d40a2754 100644 --- a/tests/src/testdata.rs +++ b/tests/src/testdata.rs @@ -42,7 +42,7 @@ pub fn key_template_proto(dir: &str, name: &str) -> Result, } +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct TestGroup { #[serde(flatten)] diff --git a/tests/tests/daead/factory_test.rs b/tests/tests/daead/factory_test.rs index fa46cf4d0..ed79bc66a 100644 --- a/tests/tests/daead/factory_test.rs +++ b/tests/tests/daead/factory_test.rs @@ -88,13 +88,13 @@ fn test_factory_raw_key_as_primary() { // Return an `Err` if decryption fails, panic if something else goes wrong. #[allow(clippy::borrowed_box)] -fn validate_daead_factory_cipher( +fn validate_daead_factory_cipher( encrypt_cipher: &Box, decrypt_cipher: &Box, expected_prefix: &[u8], ) -> Result<(), TinkError> where - T: tink_core::DeterministicAead, + T: tink_core::DeterministicAead + ?Sized, { let prefix_size = expected_prefix.len(); // regular plaintext. diff --git a/tests/tests/mac/subtle/cmac_test.rs b/tests/tests/mac/subtle/cmac_test.rs index 1fbcb684b..00f3f7fd6 100644 --- a/tests/tests/mac/subtle/cmac_test.rs +++ b/tests/tests/mac/subtle/cmac_test.rs @@ -34,6 +34,7 @@ lazy_static! { }; } +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct TestData { #[serde(flatten)] @@ -42,6 +43,7 @@ pub struct TestData { pub test_groups: Vec, } +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct TestGroup { #[serde(flatten)] diff --git a/tests/tests/prf/subtle/aes_cmac_test.rs b/tests/tests/prf/subtle/aes_cmac_test.rs index c7f606f7b..28d8e8a35 100644 --- a/tests/tests/prf/subtle/aes_cmac_test.rs +++ b/tests/tests/prf/subtle/aes_cmac_test.rs @@ -43,6 +43,7 @@ fn test_vectors_rfc4493() { } } +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct TestData { #[serde(flatten)] @@ -51,6 +52,7 @@ pub struct TestData { pub test_groups: Vec, } +#[allow(dead_code)] #[derive(Debug, Deserialize)] pub struct TestGroup { #[serde(flatten)] diff --git a/tests/tests/signature/ecdsa_signer_key_manager_test.rs b/tests/tests/signature/ecdsa_signer_key_manager_test.rs index 31587da87..936243c53 100644 --- a/tests/tests/signature/ecdsa_signer_key_manager_test.rs +++ b/tests/tests/signature/ecdsa_signer_key_manager_test.rs @@ -106,7 +106,7 @@ fn test_ecdsa_sign_new_key_with_invalid_input() { let km = tink_core::registry::get_key_manager(tink_tests::ECDSA_SIGNER_TYPE_URL) .expect("cannot obtain EcdsaSigner key manager"); // invalid hash and curve type - let test_params = vec![ + let test_params = [ EcdsaParams { hash_type: HashType::UnknownHash as i32, curve: EllipticCurveType::NistP256 as i32,