summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-20 19:26:48 +0300
committerLars Wirzenius <liw@liw.fi>2021-09-21 09:56:49 +0300
commit7febc9e2722f7ca97be91dc4a68c9f6a0502dc27 (patch)
tree9159e67837902e39cd251c777f66c23789920ca2 /openpgp
parenteff8edd82629a4e6151d4bcb104a7695c6975e8d (diff)
Avoid matching on &Foo, when a plain Foo pattern works
The extra & in a pattern (match arm or if let) is unnecessary and only makes the code harder to read. In most places it's enough to just remove the & from the pattern, but in a few places a dereference (*) needs to be added where the value captured in the pattern is used, as removing the & changes the type of the captured value to be a reference. Overall, the changes are almost mechanical. Although the diff is huge, it should be easy to read. The clippy lint match_ref_pats warns about this. See: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/armor.rs10
-rw-r--r--openpgp/src/cert/parser/low_level/lexer.rs18
-rw-r--r--openpgp/src/crypto/backend/nettle/ecdh.rs2
-rw-r--r--openpgp/src/crypto/ecdh.rs2
-rw-r--r--openpgp/src/crypto/mpi.rs64
-rw-r--r--openpgp/src/fingerprint.rs8
-rw-r--r--openpgp/src/keyid.rs8
-rw-r--r--openpgp/src/message/mod.rs2
-rw-r--r--openpgp/src/packet/mod.rs122
-rw-r--r--openpgp/src/packet/skesk.rs4
-rw-r--r--openpgp/src/packet/tag.rs42
-rw-r--r--openpgp/src/parse.rs15
-rw-r--r--openpgp/src/serialize.rs286
-rw-r--r--openpgp/src/types/mod.rs32
14 files changed, 310 insertions, 305 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index 7f35a804..851408a2 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -211,11 +211,11 @@ impl Kind {
fn blurb(&self) -> &str {
match self {
- &Kind::Message => "MESSAGE",
- &Kind::PublicKey => "PUBLIC KEY BLOCK",
- &Kind::SecretKey => "PRIVATE KEY BLOCK",
- &Kind::Signature => "SIGNATURE",
- &Kind::File => "ARMORED FILE",
+ Kind::Message => "MESSAGE",
+ Kind::PublicKey => "PUBLIC KEY BLOCK",
+ Kind::SecretKey => "PRIVATE KEY BLOCK",
+ Kind::Signature => "SIGNATURE",
+ Kind::File => "ARMORED FILE",
}
}
diff --git a/openpgp/src/cert/parser/low_level/lexer.rs b/openpgp/src/cert/parser/low_level/lexer.rs
index a8fad2e8..1a698579 100644
--- a/openpgp/src/cert/parser/low_level/lexer.rs
+++ b/openpgp/src/cert/parser/low_level/lexer.rs
@@ -64,15 +64,15 @@ assert_send_and_sync!(Component);
impl<'a> From<&'a Token> for Tag {
fn from(token: &'a Token) -> Self {
match token {
- &Token::PublicKey(_) => Tag::PublicKey,
- &Token::SecretKey(_) => Tag::SecretKey,
- &Token::PublicSubkey(_) => Tag::PublicSubkey,
- &Token::SecretSubkey(_) => Tag::SecretSubkey,
- &Token::UserID(_) => Tag::UserID,
- &Token::UserAttribute(_) => Tag::UserAttribute,
- &Token::Signature(_) => Tag::Signature,
- &Token::Trust(_) => Tag::Trust,
- &Token::Unknown(tag, _) => tag,
+ Token::PublicKey(_) => Tag::PublicKey,
+ Token::SecretKey(_) => Tag::SecretKey,
+ Token::PublicSubkey(_) => Tag::PublicSubkey,
+ Token::SecretSubkey(_) => Tag::SecretSubkey,
+ Token::UserID(_) => Tag::UserID,
+ Token::UserAttribute(_) => Tag::UserAttribute,
+ Token::Signature(_) => Tag::Signature,
+ Token::Trust(_) => Tag::Trust,
+ Token::Unknown(tag, _) => *tag,
}
}
}
diff --git a/openpgp/src/crypto/backend/nettle/ecdh.rs b/openpgp/src/crypto/backend/nettle/ecdh.rs
index c26a843b..af1a7220 100644
--- a/openpgp/src/crypto/backend/nettle/ecdh.rs
+++ b/openpgp/src/crypto/backend/nettle/ecdh.rs
@@ -19,7 +19,7 @@ pub fn encrypt<R>(recipient: &Key<key::PublicParts, R>,
{
let mut rng = Yarrow::default();
- if let &PublicKey::ECDH {
+ if let PublicKey::ECDH {
ref curve, ref q,..
} = recipient.mpis() {
match curve {
diff --git a/openpgp/src/crypto/ecdh.rs b/openpgp/src/crypto/ecdh.rs
index c49807f5..3407e8a3 100644
--- a/openpgp/src/crypto/ecdh.rs
+++ b/openpgp/src/crypto/ecdh.rs
@@ -40,7 +40,7 @@ pub(crate) fn encrypt_wrap<R>(recipient: &Key<key::PublicParts, R>,
where R: key::KeyRole
{
match recipient.mpis() {
- &mpi::PublicKey::ECDH { ref curve, ref hash, ref sym,.. } => {
+ mpi::PublicKey::ECDH { ref curve, ref hash, ref sym,.. } => {
// m = sym_alg_ID || session key || checksum || pkcs5_padding;
let mut m = Vec::with_capacity(40);
m.extend_from_slice(session_key);
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index ae7e9b1b..0bda2b52 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -521,13 +521,13 @@ impl PublicKey {
pub fn bits(&self) -> Option<usize> {
use self::PublicKey::*;
match self {
- &RSA { ref n,.. } => Some(n.bits()),
- &DSA { ref p,.. } => Some(p.bits()),
- &ElGamal { ref p,.. } => Some(p.bits()),
- &EdDSA { ref curve,.. } => curve.bits(),
- &ECDSA { ref curve,.. } => curve.bits(),
- &ECDH { ref curve,.. } => curve.bits(),
- &Unknown { .. } => None,
+ RSA { ref n,.. } => Some(n.bits()),
+ DSA { ref p,.. } => Some(p.bits()),
+ ElGamal { ref p,.. } => Some(p.bits()),
+ EdDSA { ref curve,.. } => curve.bits(),
+ ECDSA { ref curve,.. } => curve.bits(),
+ ECDH { ref curve,.. } => curve.bits(),
+ Unknown { .. } => None,
}
}
@@ -671,36 +671,36 @@ impl fmt::Debug for SecretKeyMaterial {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if cfg!(debug_assertions) {
match self {
- &SecretKeyMaterial::RSA{ ref d, ref p, ref q, ref u } =>
+ SecretKeyMaterial::RSA{ ref d, ref p, ref q, ref u } =>
write!(f, "RSA {{ d: {:?}, p: {:?}, q: {:?}, u: {:?} }}", d, p, q, u),
- &SecretKeyMaterial::DSA{ ref x } =>
+ SecretKeyMaterial::DSA{ ref x } =>
write!(f, "DSA {{ x: {:?} }}", x),
- &SecretKeyMaterial::ElGamal{ ref x } =>
+ SecretKeyMaterial::ElGamal{ ref x } =>
write!(f, "ElGamal {{ x: {:?} }}", x),
- &SecretKeyMaterial::EdDSA{ ref scalar } =>
+ SecretKeyMaterial::EdDSA{ ref scalar } =>
write!(f, "EdDSA {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::ECDSA{ ref scalar } =>
+ SecretKeyMaterial::ECDSA{ ref scalar } =>
write!(f, "ECDSA {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::ECDH{ ref scalar } =>
+ SecretKeyMaterial::ECDH{ ref scalar } =>
write!(f, "ECDH {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::Unknown{ ref mpis, ref rest } =>
+ SecretKeyMaterial::Unknown{ ref mpis, ref rest } =>
write!(f, "Unknown {{ mips: {:?}, rest: {:?} }}", mpis, rest),
}
} else {
match self {
- &SecretKeyMaterial::RSA{ .. } =>
+ SecretKeyMaterial::RSA{ .. } =>
f.write_str("RSA { <Redacted> }"),
- &SecretKeyMaterial::DSA{ .. } =>
+ SecretKeyMaterial::DSA{ .. } =>
f.write_str("DSA { <Redacted> }"),
- &SecretKeyMaterial::ElGamal{ .. } =>
+ SecretKeyMaterial::ElGamal{ .. } =>
f.write_str("ElGamal { <Redacted> }"),
- &SecretKeyMaterial::EdDSA{ .. } =>
+ SecretKeyMaterial::EdDSA{ .. } =>
f.write_str("EdDSA { <Redacted> }"),
- &SecretKeyMaterial::ECDSA{ .. } =>
+ SecretKeyMaterial::ECDSA{ .. } =>
f.write_str("ECDSA { <Redacted> }"),
- &SecretKeyMaterial::ECDH{ .. } =>
+ SecretKeyMaterial::ECDH{ .. } =>
f.write_str("ECDH { <Redacted> }"),
- &SecretKeyMaterial::Unknown{ .. } =>
+ SecretKeyMaterial::Unknown{ .. } =>
f.write_str("Unknown { <Redacted> }"),
}
}
@@ -713,13 +713,13 @@ impl PartialOrd for SecretKeyMaterial {
fn discriminant(sk: &SecretKeyMaterial) -> usize {
match sk {
- &SecretKeyMaterial::RSA{ .. } => 0,
- &SecretKeyMaterial::DSA{ .. } => 1,
- &SecretKeyMaterial::ElGamal{ .. } => 2,
- &SecretKeyMaterial::EdDSA{ .. } => 3,
- &SecretKeyMaterial::ECDSA{ .. } => 4,
- &SecretKeyMaterial::ECDH{ .. } => 5,
- &SecretKeyMaterial::Unknown{ .. } => 6,
+ SecretKeyMaterial::RSA{ .. } => 0,
+ SecretKeyMaterial::DSA{ .. } => 1,
+ SecretKeyMaterial::ElGamal{ .. } => 2,
+ SecretKeyMaterial::EdDSA{ .. } => 3,
+ SecretKeyMaterial::ECDSA{ .. } => 4,
+ SecretKeyMaterial::ECDH{ .. } => 5,
+ SecretKeyMaterial::Unknown{ .. } => 6,
}
}
@@ -928,10 +928,10 @@ impl Ciphertext {
// plus the big endian value itself. All other field types are
// commented.
match self {
- &RSA { .. } => Some(PublicKeyAlgorithm::RSAEncryptSign),
- &ElGamal { .. } => Some(PublicKeyAlgorithm::ElGamalEncrypt),
- &ECDH { .. } => Some(PublicKeyAlgorithm::ECDH),
- &Unknown { .. } => None,
+ RSA { .. } => Some(PublicKeyAlgorithm::RSAEncryptSign),
+ ElGamal { .. } => Some(PublicKeyAlgorithm::ElGamalEncrypt),
+ ECDH { .. } => Some(PublicKeyAlgorithm::ECDH),
+ Unknown { .. } => None,
}
}
}
diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs
index b7fbc3af..d60f3faa 100644
--- a/openpgp/src/fingerprint.rs
+++ b/openpgp/src/fingerprint.rs
@@ -141,8 +141,8 @@ impl Fingerprint {
/// ```
pub fn as_bytes(&self) -> &[u8] {
match self {
- &Fingerprint::V4(ref fp) => fp,
- &Fingerprint::Invalid(ref fp) => fp,
+ Fingerprint::V4(ref fp) => fp,
+ Fingerprint::Invalid(ref fp) => fp,
}
}
@@ -233,8 +233,8 @@ impl Fingerprint {
/// Common code for the above functions.
fn convert_to_string(&self, pretty: bool) -> String {
let raw = match self {
- &Fingerprint::V4(ref fp) => &fp[..],
- &Fingerprint::Invalid(ref fp) => &fp[..],
+ Fingerprint::V4(ref fp) => &fp[..],
+ Fingerprint::Invalid(ref fp) => &fp[..],
};
// We currently only handle V4 fingerprints, which look like:
diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs
index 632b9439..6186d208 100644
--- a/openpgp/src/keyid.rs
+++ b/openpgp/src/keyid.rs
@@ -240,8 +240,8 @@ impl KeyID {
/// ```
pub fn as_bytes(&self) -> &[u8] {
match self {
- &KeyID::V4(ref id) => id,
- &KeyID::Invalid(ref id) => id,
+ KeyID::V4(ref id) => id,
+ KeyID::Invalid(ref id) => id,
}
}
@@ -353,8 +353,8 @@ impl KeyID {
/// Common code for the above functions.
fn convert_to_string(&self, pretty: bool) -> String {
let raw = match self {
- &KeyID::V4(ref fp) => &fp[..],
- &KeyID::Invalid(ref fp) => &fp[..],
+ KeyID::V4(ref fp) => &fp[..],
+ KeyID::Invalid(ref fp) => &fp[..],
};
// We currently only handle V4 Key IDs, which look like:
diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs
index 2d92f44d..662e4e02 100644
--- a/openpgp/src/message/mod.rs
+++ b/openpgp/src/message/mod.rs
@@ -408,7 +408,7 @@ impl Message {
/// ```
pub fn body(&self) -> Option<&Literal> {
for packet in self.pile.descendants() {
- if let &Packet::Literal(ref l) = packet {
+ if let Packet::Literal(ref l) = packet {
return Some(l);
}
}
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs
index e3e1ffc5..7de9b603 100644
--- a/openpgp/src/packet/mod.rs
+++ b/openpgp/src/packet/mod.rs
@@ -330,24 +330,24 @@ impl Packet {
/// [Section 4.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4.3
pub fn tag(&self) -> Tag {
match self {
- &Packet::Unknown(ref packet) => packet.tag(),
- &Packet::Signature(_) => Tag::Signature,
- &Packet::OnePassSig(_) => Tag::OnePassSig,
- &Packet::PublicKey(_) => Tag::PublicKey,
- &Packet::PublicSubkey(_) => Tag::PublicSubkey,
- &Packet::SecretKey(_) => Tag::SecretKey,
- &Packet::SecretSubkey(_) => Tag::SecretSubkey,
- &Packet::Marker(_) => Tag::Marker,
- &Packet::Trust(_) => Tag::Trust,
- &Packet::UserID(_) => Tag::UserID,
- &Packet::UserAttribute(_) => Tag::UserAttribute,
- &Packet::Literal(_) => Tag::Literal,
- &Packet::CompressedData(_) => Tag::CompressedData,
- &Packet::PKESK(_) => Tag::PKESK,
- &Packet::SKESK(_) => Tag::SKESK,
- &Packet::SEIP(_) => Tag::SEIP,
- &Packet::MDC(_) => Tag::MDC,
- &Packet::AED(_) => Tag::AED,
+ Packet::Unknown(ref packet) => packet.tag(),
+ Packet::Signature(_) => Tag::Signature,
+ Packet::OnePassSig(_) => Tag::OnePassSig,
+ Packet::PublicKey(_) => Tag::PublicKey,
+ Packet::PublicSubkey(_) => Tag::PublicSubkey,
+ Packet::SecretKey(_) => Tag::SecretKey,
+ Packet::SecretSubkey(_) => Tag::SecretSubkey,
+ Packet::Marker(_) => Tag::Marker,
+ Packet::Trust(_) => Tag::Trust,
+ Packet::UserID(_) => Tag::UserID,
+ Packet::UserAttribute(_) => Tag::UserAttribute,
+ Packet::Literal(_) => Tag::Literal,
+ Packet::CompressedData(_) => Tag::CompressedData,
+ Packet::PKESK(_) => Tag::PKESK,
+ Packet::SKESK(_) => Tag::SKESK,
+ Packet::SEIP(_) => Tag::SEIP,
+ Packet::MDC(_) => Tag::MDC,
+ Packet::AED(_) => Tag::AED,
}
}
@@ -360,7 +360,7 @@ impl Packet {
/// whereas `kind()` returns `None`.
pub fn kind(&self) -> Option<Tag> {
match self {
- &Packet::Unknown(_) => None,
+ Packet::Unknown(_) => None,
_ => Some(self.tag()),
}
}
@@ -413,25 +413,25 @@ impl Deref for Packet {
fn deref(&self) -> &Self::Target {
match self {
- &Packet::Unknown(ref packet) => &packet.common,
- &Packet::Signature(ref packet) => &packet.common,
- &Packet::OnePassSig(ref packet) => &packet.common,
- &Packet::PublicKey(ref packet) => &packet.common,
- &Packet::PublicSubkey(ref packet) => &packet.common,
- &Packet::SecretKey(ref packet) => &packet.common,
- &Packet::SecretSubkey(ref packet) => &packet.common,
- &Packet::Marker(ref packet) => &packet.common,
- &Packet::Trust(ref packet) => &packet.common,
- &Packet::UserID(ref packet) => &packet.common,
- &Packet::UserAttribute(ref packet) => &packet.common,
- &Packet::Literal(ref packet) => &packet.common,
- &Packet::CompressedData(ref packet) => &packet.common,
- &Packet::PKESK(ref packet) => &packet.common,
- &Packet::SKESK(SKESK::V4(ref packet)) => &packet.common,
- &Packet::SKESK(SKESK::V5(ref packet)) => &packet.skesk4.common,
- &Packet::SEIP(ref packet) => &packet.common,
- &Packet::MDC(ref packet) => &packet.common,
- &Packet::AED(ref packet) => &packet.common,
+ Packet::Unknown(ref packet) => &packet.common,
+ Packet::Signature(ref packet) => &packet.common,
+ Packet::OnePassSig(ref packet) => &packet.common,
+ Packet::PublicKey(ref packet) => &packet.common,
+ Packet::PublicSubkey(ref packet) => &packet.common,
+ Packet::SecretKey(ref packet) => &packet.common,
+ Packet::SecretSubkey(ref packet) => &packet.common,
+ Packet::Marker(ref packet) => &packet.common,
+ Packet::Trust(ref packet) => &packet.common,
+ Packet::UserID(ref packet) => &packet.common,
+ Packet::UserAttribute(ref packet) => &packet.common,
+ Packet::Literal(ref packet) => &packet.common,
+ Packet::CompressedData(ref packet) => &packet.common,
+ Packet::PKESK(ref packet) => &packet.common,
+ Packet::SKESK(SKESK::V4(ref packet)) => &packet.common,
+ Packet::SKESK(SKESK::V5(ref packet)) => &packet.skesk4.common,
+ Packet::SEIP(ref packet) => &packet.common,
+ Packet::MDC(ref packet) => &packet.common,
+ Packet::AED(ref packet) => &packet.common,
}
}
}
@@ -439,25 +439,25 @@ impl Deref for Packet {
impl DerefMut for Packet {
fn deref_mut(&mut self) -> &mut Common {
match self {
- &mut Packet::Unknown(ref mut packet) => &mut packet.common,
- &mut Packet::Signature(ref mut packet) => &mut packet.common,
- &mut Packet::OnePassSig(ref mut packet) => &mut packet.common,
- &mut Packet::PublicKey(ref mut packet) => &mut packet.common,
- &mut Packet::PublicSubkey(ref mut packet) => &mut packet.common,
- &mut Packet::SecretKey(ref mut packet) => &mut packet.common,
- &mut Packet::SecretSubkey(ref mut packet) => &mut packet.common,
- &mut Packet::Marker(ref mut packet) => &mut packet.common,
- &mut Packet::Trust(ref mut packet) => &mut packet.common,
- &mut Packet::UserID(ref mut packet) => &mut packet.common,
- &mut Packet::UserAttribute(ref mut packet) => &mut packet.common,
- &mut Packet::Literal(ref mut packet) => &mut packet.common,
- &mut Packet::CompressedData(ref mut packet) => &mut packet.common,
- &mut Packet::PKESK(ref mut packet) => &mut packet.common,
- &mut Packet::SKESK(SKESK::V4(ref mut packet)) => &mut packet.common,
- &mut Packet::SKESK(SKESK::V5(ref mut packet)) => &mut packet.skesk4.common,
- &mut Packet::SEIP(ref mut packet) => &mut packet.common,
- &mut Packet::MDC(ref mut packet) => &mut packet.common,
- &mut Packet::AED(ref mut packet) => &mut packet.common,
+ Packet::Unknown(ref mut packet) => &mut packet.common,
+ Packet::Signature(ref mut packet) => &mut packet.common,
+ Packet::OnePassSig(ref mut packet) => &mut packet.common,
+ Packet::PublicKey(ref mut packet) => &mut packet.common,
+ Packet::PublicSubkey(ref mut packet) => &mut packet.common,
+ Packet::SecretKey(ref mut packet) => &mut packet.common,
+ Packet::SecretSubkey(ref mut packet) => &mut packet.common,
+ Packet::Marker(ref mut packet) => &mut packet.common,
+ Packet::Trust(ref mut packet) => &mut packet.common,
+ Packet::UserID(ref mut packet) => &mut packet.common,
+ Packet::UserAttribute(ref mut packet) => &mut packet.common,
+ Packet::Literal(ref mut packet) => &mut packet.common,
+ Packet::CompressedData(ref mut packet) => &mut packet.common,
+ Packet::PKESK(ref mut packet) => &mut packet.common,
+ Packet::SKESK(SKESK::V4(ref mut packet)) => &mut packet.common,
+ Packet::SKESK(SKESK::V5(ref mut packet)) => &mut packet.skesk4.common,
+ Packet::SEIP(ref mut packet) => &mut packet.common,
+ Packet::MDC(ref mut packet) => &mut packet.common,
+ Packet::AED(ref mut packet) => &mut packet.common,
}
}
}
@@ -972,7 +972,7 @@ impl Signature {
/// Gets the version.
pub fn version(&self) -> u8 {
match self {
- &Signature::V4(_) => 4,
+ Signature::V4(_) => 4,
}
}
}
@@ -1030,7 +1030,7 @@ impl OnePassSig {
/// Gets the version.
pub fn version(&self) -> u8 {
match self {
- &OnePassSig::V3(_) => 3,
+ OnePassSig::V3(_) => 3,
}
}
}
@@ -1154,8 +1154,8 @@ impl SKESK {
/// Gets the version.
pub fn version(&self) -> u8 {
match self {
- &SKESK::V4(_) => 4,
- &SKESK::V5(_) => 5,
+ SKESK::V4(_) => 4,
+ SKESK::V5(_) => 5,
}
}
}
diff --git a/openpgp/src/packet/skesk.rs b/openpgp/src/packet/skesk.rs
index 65ecdc11..026c3c1a 100644
--- a/openpgp/src/packet/skesk.rs
+++ b/openpgp/src/packet/skesk.rs
@@ -30,8 +30,8 @@ impl SKESK {
-> Result<(SymmetricAlgorithm, SessionKey)>
{
match self {
- &SKESK::V4(ref s) => s.decrypt(password),
- &SKESK::V5(ref s) => s.decrypt(password),
+ SKESK::V4(ref s) => s.decrypt(password),
+ SKESK::V5(ref s) => s.decrypt(password),
}
}
}
diff --git a/openpgp/src/packet/tag.rs b/openpgp/src/packet/tag.rs
index 5b10f437..c15c51c4 100644
--- a/openpgp/src/packet/tag.rs
+++ b/openpgp/src/packet/tag.rs
@@ -131,27 +131,27 @@ impl From<Tag> for u8 {
impl From<&Tag> for u8 {
fn from(t: &Tag) -> u8 {
match t {
- &Tag::Reserved => 0,
- &Tag::PKESK => 1,
- &Tag::Signature => 2,
- &Tag::SKESK => 3,
- &Tag::OnePassSig => 4,
- &Tag::SecretKey => 5,
- &Tag::PublicKey => 6,
- &Tag::SecretSubkey => 7,
- &Tag::CompressedData => 8,
- &Tag::SED => 9,
- &Tag::Marker => 10,
- &Tag::Literal => 11,
- &Tag::Trust => 12,
- &Tag::UserID => 13,
- &Tag::PublicSubkey => 14,
- &Tag::UserAttribute => 17,
- &Tag::SEIP => 18,
- &Tag::MDC => 19,
- &Tag::AED => 20,
- &Tag::Private(x) => x,
- &Tag::Unknown(x) => x,
+ Tag::Reserved => 0,
+ Tag::PKESK => 1,
+ Tag::Signature => 2,
+ Tag::SKESK => 3,
+ Tag::OnePassSig => 4,
+ Tag::SecretKey => 5,
+ Tag::PublicKey => 6,
+ Tag::SecretSubkey => 7,
+ Tag::CompressedData => 8,
+ Tag::SED => 9,
+ Tag::Marker => 10,
+ Tag::Literal => 11,
+ Tag::Trust => 12,
+ Tag::UserID => 13,
+ Tag::PublicSubkey => 14,
+ Tag::UserAttribute => 17,
+ Tag::SEIP => 18,
+ Tag::MDC => 19,
+ Tag::AED => 20,
+ Tag::Private(x) => *x,
+ Tag::Unknown(x) => *x,
}
}
}
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index fbb5cfff..803813e8 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -1447,8 +1447,8 @@ impl Signature4 {
// The absolute minimum size for the header is 11 bytes (this
// doesn't include the signature MPIs).
- if let &BodyLength::Full(len) = header.length() {
- if len < 11 {
+ if let BodyLength::Full(len) = header.length() {
+ if *len < 11 {
// Much too short.
return Err(
Error::MalformedPacket("Packet too short".into()).into());
@@ -2290,8 +2290,8 @@ impl Key4<key::UnspecifiedParts, key::UnspecifiedRole>
bio: &mut buffered_reader::Dup<T, Cookie>, header: &Header)
-> Result<()> {
// The packet's header is 6 bytes.
- if let &BodyLength::Full(len) = header.length() {