Skip to content

Commit c79df12

Browse files
committed
Fix new Clippy lints
1 parent 7d1028f commit c79df12

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

proto/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ include!("codegen/google.crypto.tink.rs");
3232
#[cfg(feature = "json")]
3333
include!("codegen/serde/google.crypto.tink.rs");
3434

35+
// Manual keyset serialization implementations that map enums onto strings rather than
36+
// the `i32` values used by [prost](https://docs.rs/prost).
3537
#[cfg(feature = "json")]
3638
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
3739
pub mod json {
38-
//! Manual keyset serialization implementations that map enums onto strings rather than
39-
//! the `i32` values used by [prost](https://docs.rs/prost).
4040
pub mod key_status_type {
4141
//! Manual JSON serialization for [`KeyStatusType`](crate::KeyStatusType) enums.
4242
use serde::Deserialize;

signature/src/subtle/ecdsa_signer.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use generic_array::typenum::Unsigned;
1818
use p256::elliptic_curve;
1919
use signature::RandomizedSigner;
20-
use std::convert::TryInto;
2120
use tink_core::{utils::wrap_err, TinkError};
2221
use tink_proto::{EcdsaSignatureEncoding, EllipticCurveType, HashType};
2322

@@ -63,12 +62,8 @@ impl EcdsaSigner {
6362
return Err("EcdsaSigner: invalid private key len".into());
6463
}
6564
EcdsaPrivateKey::NistP256(
66-
p256::ecdsa::SigningKey::from_bytes(
67-
key_value
68-
.try_into()
69-
.map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?,
70-
)
71-
.map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?,
65+
p256::ecdsa::SigningKey::from_bytes(key_value.into())
66+
.map_err(|e| wrap_err("EcdsaSigner: invalid private key", e))?,
7267
)
7368
}
7469
_ => return Err(format!("EcdsaSigner: unsupported curve {curve:?}").into()),

testing/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use log::info;
2121
use structopt::StructOpt;
2222
use tonic::transport::Server;
2323

24-
#[allow(clippy::wrong_self_convention)]
2524
pub mod proto {
2625
//! Auto-generated code from protocol buffer message and service definitions.
26+
#![allow(clippy::wrong_self_convention)]
2727
#![allow(clippy::large_enum_variant)]
2828
#![allow(clippy::derive_partial_eq_without_eq)]
2929
include!("codegen/tink_testing_api.rs");

tests/src/testdata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn key_template_proto(dir: &str, name: &str) -> Result<KeyTemplate, TinkErro
4242
let value_re = Regex::new(r#"^\s*value\s*:\s*"(.+)"\s*$"#).unwrap();
4343
let prefix_re = Regex::new(r#"^\s*output_prefix_type\s*:\s*(\S+)\s*$"#).unwrap();
4444
let file = std::fs::File::open(&path).map_err(|e| wrap_err("Failed to open", e))?;
45-
for line in std::io::BufReader::new(file).lines().flatten() {
45+
for line in std::io::BufReader::new(file).lines().map_while(Result::ok) {
4646
if comment_re.is_match(&line) {
4747
continue;
4848
}

tests/tests/aead/subtle/wycheproof.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct TestData {
2727
pub test_groups: Vec<TestGroup>,
2828
}
2929

30+
#[allow(dead_code)]
3031
#[derive(Debug, Deserialize)]
3132
pub struct TestGroup {
3233
#[serde(flatten)]

tests/tests/daead/factory_test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ fn test_factory_raw_key_as_primary() {
8888

8989
// Return an `Err` if decryption fails, panic if something else goes wrong.
9090
#[allow(clippy::borrowed_box)]
91-
fn validate_daead_factory_cipher<T: ?Sized>(
91+
fn validate_daead_factory_cipher<T>(
9292
encrypt_cipher: &Box<T>,
9393
decrypt_cipher: &Box<T>,
9494
expected_prefix: &[u8],
9595
) -> Result<(), TinkError>
9696
where
97-
T: tink_core::DeterministicAead,
97+
T: tink_core::DeterministicAead + ?Sized,
9898
{
9999
let prefix_size = expected_prefix.len();
100100
// regular plaintext.

tests/tests/mac/subtle/cmac_test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ lazy_static! {
3434
};
3535
}
3636

37+
#[allow(dead_code)]
3738
#[derive(Debug, Deserialize)]
3839
pub struct TestData {
3940
#[serde(flatten)]
@@ -42,6 +43,7 @@ pub struct TestData {
4243
pub test_groups: Vec<TestGroup>,
4344
}
4445

46+
#[allow(dead_code)]
4547
#[derive(Debug, Deserialize)]
4648
pub struct TestGroup {
4749
#[serde(flatten)]

tests/tests/prf/subtle/aes_cmac_test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fn test_vectors_rfc4493() {
4343
}
4444
}
4545

46+
#[allow(dead_code)]
4647
#[derive(Debug, Deserialize)]
4748
pub struct TestData {
4849
#[serde(flatten)]
@@ -51,6 +52,7 @@ pub struct TestData {
5152
pub test_groups: Vec<TestGroup>,
5253
}
5354

55+
#[allow(dead_code)]
5456
#[derive(Debug, Deserialize)]
5557
pub struct TestGroup {
5658
#[serde(flatten)]

tests/tests/signature/ecdsa_signer_key_manager_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn test_ecdsa_sign_new_key_with_invalid_input() {
106106
let km = tink_core::registry::get_key_manager(tink_tests::ECDSA_SIGNER_TYPE_URL)
107107
.expect("cannot obtain EcdsaSigner key manager");
108108
// invalid hash and curve type
109-
let test_params = vec![
109+
let test_params = [
110110
EcdsaParams {
111111
hash_type: HashType::UnknownHash as i32,
112112
curve: EllipticCurveType::NistP256 as i32,

0 commit comments

Comments
 (0)