diff options
Diffstat (limited to 'openpgp/src')
-rw-r--r-- | openpgp/src/crypto/hash.rs | 11 | ||||
-rw-r--r-- | openpgp/src/message/mod.rs | 3 | ||||
-rw-r--r-- | openpgp/src/packet/key.rs | 5 |
3 files changed, 11 insertions, 8 deletions
diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs index 10ed9787..b78f1a20 100644 --- a/openpgp/src/crypto/hash.rs +++ b/openpgp/src/crypto/hash.rs @@ -490,11 +490,12 @@ impl Signature4 { // This code assumes that the signature has been verified // prior to being confirmed, so it is well-formed. - let mut body = Vec::new(); - body.push(self.version()); - body.push(self.typ().into()); - body.push(self.pk_algo().into()); - body.push(self.hash_algo().into()); + let mut body = vec![ + self.version(), + self.typ().into(), + self.pk_algo().into(), + self.hash_algo().into(), + ]; // The hashed area. let l = self.hashed_area().serialized_len() diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs index 662e4e02..0967607e 100644 --- a/openpgp/src/message/mod.rs +++ b/openpgp/src/message/mod.rs @@ -799,6 +799,7 @@ mod tests { assert!(message.is_ok(), "{:?}", message); } + #[allow(clippy::vec_init_then_push)] #[test] fn compressed_part() { let mut lit = Literal::new(Text); @@ -861,6 +862,7 @@ mod tests { assert!(message.is_ok(), "{:?}", message); } + #[allow(clippy::vec_init_then_push)] #[test] fn one_pass_sig_part() { let mut lit = Literal::new(Text); @@ -973,6 +975,7 @@ mod tests { assert!(message.is_ok(), "{:?}", message); } + #[allow(clippy::vec_init_then_push)] #[test] fn signature_part() { let mut lit = Literal::new(Text); diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index 6e75c604..ef49a291 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -1404,10 +1404,9 @@ assert_send_and_sync!(Unencrypted); impl From<mpi::SecretKeyMaterial> for Unencrypted { fn from(mpis: mpi::SecretKeyMaterial) -> Self { use crate::serialize::Marshal; - let mut plaintext = Vec::new(); // We need to store the type. - plaintext.push( - mpis.algo().unwrap_or(PublicKeyAlgorithm::Unknown(0)).into()); + let mut plaintext = + vec![mpis.algo().unwrap_or(PublicKeyAlgorithm::Unknown(0)).into()]; mpis.serialize(&mut plaintext) .expect("MPI serialization to vec failed"); Unencrypted { mpis: mem::Encrypted::new(plaintext.into()), } |