summaryrefslogtreecommitdiffstats
path: root/openpgp/src/keyid.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/keyid.rs')
-rw-r--r--openpgp/src/keyid.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs
index 7b545165..a507527f 100644
--- a/openpgp/src/keyid.rs
+++ b/openpgp/src/keyid.rs
@@ -17,6 +17,7 @@ use crate::Result;
///
/// Note: This enum cannot be exhaustively matched to allow future
/// extensions.
+#[non_exhaustive]
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub enum KeyID {
/// Lower 8 byte SHA-1 hash.
@@ -25,10 +26,6 @@ pub enum KeyID {
/// instance, we don't grok v3 keyids. And, it is possible that
/// the Issuer subpacket contains the wrong number of bytes.
Invalid(Box<[u8]>),
-
- /// This marks this enum as non-exhaustive. Do not use this
- /// variant.
- #[doc(hidden)] __Nonexhaustive,
}
impl fmt::Display for KeyID {
@@ -82,7 +79,6 @@ impl From<KeyID> for Vec<u8> {
match id {
KeyID::V4(ref b) => r.extend_from_slice(b),
KeyID::Invalid(ref b) => r.extend_from_slice(b),
- KeyID::__Nonexhaustive => unreachable!(),
}
r
}
@@ -108,7 +104,6 @@ impl From<&Fingerprint> for KeyID {
Fingerprint::Invalid(fp) => {
KeyID::Invalid(fp.clone())
}
- Fingerprint::__Nonexhaustive => unreachable!(),
}
}
}
@@ -121,7 +116,6 @@ impl From<Fingerprint> for KeyID {
Fingerprint::Invalid(fp) => {
KeyID::Invalid(fp)
}
- Fingerprint::__Nonexhaustive => unreachable!(),
}
}
}
@@ -140,7 +134,6 @@ impl KeyID {
Ok(u64::from_be_bytes(*b)),
KeyID::Invalid(_) =>
Err(Error::InvalidArgument("Invalid KeyID".into()).into()),
- KeyID::__Nonexhaustive => unreachable!(),
}
}
@@ -160,7 +153,6 @@ impl KeyID {
match self {
&KeyID::V4(ref id) => id,
&KeyID::Invalid(ref id) => id,
- KeyID::__Nonexhaustive => unreachable!(),
}
}
@@ -218,7 +210,6 @@ impl KeyID {
let raw = match self {
&KeyID::V4(ref fp) => &fp[..],
&KeyID::Invalid(ref fp) => &fp[..],
- KeyID::__Nonexhaustive => unreachable!(),
};
// We currently only handle V4 key IDs, which look like: