From 1e50e90a13265ea675140b75102281dccfd13baa Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Thu, 25 Apr 2024 11:20:40 -0400 Subject: [PATCH] Per Clippy --- aws-lc-rs/src/cipher.rs | 20 ++++++++------------ aws-lc-rs/src/cipher/padded.rs | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/aws-lc-rs/src/cipher.rs b/aws-lc-rs/src/cipher.rs index 249e53679d5..ec5c17cc92a 100644 --- a/aws-lc-rs/src/cipher.rs +++ b/aws-lc-rs/src/cipher.rs @@ -464,7 +464,7 @@ impl Debug for EncryptingKey { f.debug_struct("EncryptingKey") .field("algorithm", self.algorithm) .field("mode", &self.mode) - .finish() + .finish_non_exhaustive() } } @@ -532,7 +532,7 @@ impl Debug for DecryptingKey { f.debug_struct("DecryptingKey") .field("algorithm", &self.algorithm) .field("mode", &self.mode) - .finish() + .finish_non_exhaustive() } } @@ -556,14 +556,10 @@ fn encrypt( match mode { OperatingMode::CBC => match algorithm.id() { - AlgorithmId::Aes128 | AlgorithmId::Aes256 => { - encrypt_aes_cbc_mode(&key, context, in_out) - } + AlgorithmId::Aes128 | AlgorithmId::Aes256 => encrypt_aes_cbc_mode(key, context, in_out), }, OperatingMode::CTR => match algorithm.id() { - AlgorithmId::Aes128 | AlgorithmId::Aes256 => { - encrypt_aes_ctr_mode(&key, context, in_out) - } + AlgorithmId::Aes128 | AlgorithmId::Aes256 => encrypt_aes_ctr_mode(key, context, in_out), }, } } @@ -757,7 +753,7 @@ mod tests { UnboundCipherKey::new(&AES_128, key_bytes).unwrap(), ) .unwrap(); - assert_eq!("PaddedBlockEncryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CBC, padding: PKCS7 }", format!("{key:?}")); + assert_eq!("PaddedBlockEncryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CBC, padding: PKCS7, .. }", format!("{key:?}")); let mut data = vec![0u8; 16]; let context = key.encrypt(&mut data).unwrap(); assert_eq!("Iv128", format!("{context:?}")); @@ -765,20 +761,20 @@ mod tests { UnboundCipherKey::new(&AES_128, key_bytes).unwrap(), ) .unwrap(); - assert_eq!("PaddedBlockDecryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CBC, padding: PKCS7 }", format!("{key:?}")); + assert_eq!("PaddedBlockDecryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CBC, padding: PKCS7, .. }", format!("{key:?}")); } { let key_bytes = &[0u8; 16]; let key = EncryptingKey::ctr(UnboundCipherKey::new(&AES_128, key_bytes).unwrap()).unwrap(); - assert_eq!("EncryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CTR }", format!("{key:?}")); + assert_eq!("EncryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CTR, .. }", format!("{key:?}")); let mut data = vec![0u8; 16]; let context = key.encrypt(&mut data).unwrap(); assert_eq!("Iv128", format!("{context:?}")); let key = DecryptingKey::ctr(UnboundCipherKey::new(&AES_128, key_bytes).unwrap()).unwrap(); - assert_eq!("DecryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CTR }", format!("{key:?}")); + assert_eq!("DecryptingKey { algorithm: Algorithm { id: Aes128, key_len: 16, block_len: 16 }, mode: CTR, .. }", format!("{key:?}")); } } diff --git a/aws-lc-rs/src/cipher/padded.rs b/aws-lc-rs/src/cipher/padded.rs index eae5ea0db23..aee8a4d64ac 100644 --- a/aws-lc-rs/src/cipher/padded.rs +++ b/aws-lc-rs/src/cipher/padded.rs @@ -166,7 +166,7 @@ impl Debug for PaddedBlockEncryptingKey { .field("algorithm", &self.algorithm) .field("mode", &self.mode) .field("padding", &self.padding) - .finish() + .finish_non_exhaustive() } } @@ -252,7 +252,7 @@ impl Debug for PaddedBlockDecryptingKey { .field("algorithm", &self.algorithm) .field("mode", &self.mode) .field("padding", &self.padding) - .finish() + .finish_non_exhaustive() } }