diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-03-30 17:20:07 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-03-30 17:27:43 +0200 |
commit | 36f0499e08c2de7b4cb2083f933990b45a598bd1 (patch) | |
tree | c4a612f47b27a55b543e6f11bfd6ebc215439d2b /openpgp/src/lib.rs | |
parent | f06d3e34c032049ba1782a7647baa77667d3afee (diff) |
openpgp: Express Packet::kind more concisely.
Diffstat (limited to 'openpgp/src/lib.rs')
-rw-r--r-- | openpgp/src/lib.rs | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/openpgp/src/lib.rs b/openpgp/src/lib.rs index 26b05473..880819aa 100644 --- a/openpgp/src/lib.rs +++ b/openpgp/src/lib.rs @@ -424,27 +424,9 @@ impl Packet { /// into an `Packet::Unknown`. `tag()` returns `Tag::Signature`, /// whereas `kind()` returns `None`. pub fn kind(&self) -> Option<packet::Tag> { - use crate::packet::Tag; match self { &Packet::Unknown(_) => None, - &Packet::Signature(_) => Some(Tag::Signature), - &Packet::OnePassSig(_) => Some(Tag::OnePassSig), - &Packet::PublicKey(_) => Some(Tag::PublicKey), - &Packet::PublicSubkey(_) => Some(Tag::PublicSubkey), - &Packet::SecretKey(_) => Some(Tag::SecretKey), - &Packet::SecretSubkey(_) => Some(Tag::SecretSubkey), - &Packet::Marker(_) => Some(Tag::Marker), - &Packet::Trust(_) => Some(Tag::Trust), - &Packet::UserID(_) => Some(Tag::UserID), - &Packet::UserAttribute(_) => Some(Tag::UserAttribute), - &Packet::Literal(_) => Some(Tag::Literal), - &Packet::CompressedData(_) => Some(Tag::CompressedData), - &Packet::PKESK(_) => Some(Tag::PKESK), - &Packet::SKESK(_) => Some(Tag::SKESK), - &Packet::SEIP(_) => Some(Tag::SEIP), - &Packet::MDC(_) => Some(Tag::MDC), - &Packet::AED(_) => Some(Tag::AED), - Packet::__Nonexhaustive => unreachable!(), + _ => Some(self.tag()), } } } |