Tests: Silence some Clippy warnings.

This commit is contained in:
Brian Smith 2020-11-11 12:46:57 -08:00
parent 26ed1b7adc
commit 898a93f632
4 changed files with 7 additions and 0 deletions

View File

@ -101,6 +101,7 @@ impl Context {
#[cfg(test)]
pub fn check_state_layout() {
#[allow(clippy::if_same_then_else)]
let required_state_size = if cfg!(target_arch = "x86") {
// See comment above `_poly1305_init_sse2` in poly1305-x86.pl.
Some(4 * (5 + 1 + 4 + 2 + 4 * 9))

View File

@ -212,6 +212,7 @@ fn test_aead<Seal, Open>(
if cfg!(debug_assertions) {
in_prefix_lengths = &MINIMAL_IN_PREFIX_LENS[..];
} else {
#[allow(clippy::needless_range_loop)]
for b in 0..more_comprehensive_in_prefix_lengths.len() {
more_comprehensive_in_prefix_lengths[b] = b;
}
@ -300,6 +301,7 @@ fn open_with_less_safe_key<'a>(
key.open_within(nonce, aad, in_out, ciphertext_and_tag)
}
#[allow(clippy::range_plus_one)]
fn test_aead_key_sizes(aead_alg: &'static aead::Algorithm) {
let key_len = aead_alg.key_len();
let key_data = vec![0u8; key_len * 2];
@ -327,6 +329,7 @@ fn test_aead_key_sizes(aead_alg: &'static aead::Algorithm) {
}
// Test that we reject non-standard nonce sizes.
#[allow(clippy::range_plus_one)]
#[test]
fn test_aead_nonce_sizes() -> Result<(), error::Unspecified> {
let nonce_len = aead::NONCE_LEN;
@ -350,6 +353,7 @@ fn test_aead_nonce_sizes() -> Result<(), error::Unspecified> {
target_arch = "x86_64",
target_arch = "x86"
))]
#[allow(clippy::range_plus_one)]
#[test]
fn aead_chacha20_poly1305_openssh() {
// TODO: test_aead_key_sizes(...);

View File

@ -77,6 +77,7 @@ fn agreement_traits<'a>() {
);
}
#[allow(clippy::block_in_if_condition_stmt)]
#[test]
fn agreement_agree_ephemeral() {
let rng = rand::SystemRandom::new();

View File

@ -64,6 +64,7 @@ fn test_quic(alg: &'static quic::Algorithm, test_file: test::File) {
});
}
#[allow(clippy::range_plus_one)]
fn test_sample_len(alg: &'static quic::Algorithm) {
let key_len = alg.key_len();
let key_data = vec![0u8; key_len];