diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-22 12:58:47 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:55 +0100 |
commit | 049055e3ff5ffe86700b668e924fbff96e82be94 (patch) | |
tree | 30dfd63e4d1c3016210b698813e99b70787890e8 /openpgp/src/serialize.rs | |
parent | 97ce753fefae770ee0b5b02a611d75e29a7cd01d (diff) |
Remove unnecessary borrows.
- Fixed with the help of clippy::needless_borrow.
Diffstat (limited to 'openpgp/src/serialize.rs')
-rw-r--r-- | openpgp/src/serialize.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs index ae83c33f..04f36403 100644 --- a/openpgp/src/serialize.rs +++ b/openpgp/src/serialize.rs @@ -1449,7 +1449,7 @@ impl Marshal for SubpacketValue { o.write_all(reason)?; }, Features(ref f) => - o.write_all(&f.as_slice())?, + o.write_all(f.as_slice())?, SignatureTarget { pk_algo, hash_algo, ref digest } => { o.write_all(&[(*pk_algo).into(), (*hash_algo).into()])?; o.write_all(digest)?; @@ -2066,7 +2066,7 @@ impl Literal { pub(crate) fn serialize_headers(&self, o: &mut dyn std::io::Write, write_tag: bool) -> Result<()> { - let filename = if let Some(ref filename) = self.filename() { + let filename = if let Some(filename) = self.filename() { let len = cmp::min(filename.len(), 255) as u8; &filename[..len as usize] } else { @@ -2736,7 +2736,7 @@ impl<'a> PacketRef<'a> { /// [Section 4.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4.3 fn tag(&self) -> packet::Tag { match self { - PacketRef::Unknown(ref packet) => packet.tag(), + PacketRef::Unknown(packet) => packet.tag(), PacketRef::Signature(_) => Tag::Signature, PacketRef::OnePassSig(_) => Tag::OnePassSig, PacketRef::PublicKey(_) => Tag::PublicKey, @@ -2771,7 +2771,7 @@ impl<'a> Marshal for PacketRef<'a> { // Special-case the compressed data packet, because we need // the accurate length, and CompressedData::net_len() // overestimates the size. - if let PacketRef::CompressedData(ref p) = self { + if let PacketRef::CompressedData(p) = self { let mut body = Vec::new(); p.serialize(&mut body)?; BodyLength::Full(body.len() as u32).serialize(o)?; @@ -2812,7 +2812,7 @@ impl<'a> Marshal for PacketRef<'a> { // Special-case the compressed data packet, because we need // the accurate length, and CompressedData::net_len() // overestimates the size. - if let PacketRef::CompressedData(ref p) = self { + if let PacketRef::CompressedData(p) = self { let mut body = Vec::new(); p.export(&mut body)?; BodyLength::Full(body.len() as u32).export(o)?; @@ -2984,9 +2984,9 @@ mod test { eprintln!("Packet contents don't match (for {}):", filename); eprintln!("Expected ({} bytes):\n{}", - expected_body.len(), binary_pp(&expected_body)); + expected_body.len(), binary_pp(expected_body)); eprintln!("Got ({} bytes):\n{}", - got_body.len(), binary_pp(&got_body)); + got_body.len(), binary_pp(got_body)); eprintln!("Packet: {:#?}", packet); fail = true; } @@ -3050,7 +3050,7 @@ mod test { Packet::Literal(_) | Packet::Signature(_) | Packet::PublicKey(_) | Packet::PublicSubkey(_) | Packet::UserID(_) | Packet::SKESK(_) => (), - ref p => { + p => { panic!("Didn't expect a {:?} packet.", p.tag()); }, } |