summaryrefslogtreecommitdiffstats
path: root/openpgp/src/fingerprint.rs
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2020-09-22 00:45:53 +0200
committerNora Widdecke <nora@sequoia-pgp.org>2020-11-06 09:46:53 +0100
commitcdc9e16fb2aef0156d6af4abe3e519c22efa230e (patch)
treef4f5e10029ed7816bcb0931c53d27ed0e21c598c /openpgp/src/fingerprint.rs
parent327a987e2c95ea9d05fcadd6fa7a8c249372affd (diff)
openpgp: Use non_exhaustive attribute.
- Fixes #563 - With an MSRV >= 1.40.0, we can use #[non_exhaustive], as mentioned in #406. - This is also a clippy lint: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
Diffstat (limited to 'openpgp/src/fingerprint.rs')
-rw-r--r--openpgp/src/fingerprint.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs
index c2dfce1d..42a5c313 100644
--- a/openpgp/src/fingerprint.rs
+++ b/openpgp/src/fingerprint.rs
@@ -13,6 +13,7 @@ use quickcheck::{Arbitrary, Gen};
///
/// Note: This enum cannot be exhaustively matched to allow future
/// extensions.
+#[non_exhaustive]
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub enum Fingerprint {
/// 20 byte SHA-1 hash.
@@ -20,10 +21,6 @@ pub enum Fingerprint {
/// Used for holding fingerprints that we don't understand. For
/// instance, we don't grok v3 fingerprints.
Invalid(Box<[u8]>),
-
- /// This marks this enum as non-exhaustive. Do not use this
- /// variant.
- #[doc(hidden)] __Nonexhaustive,
}
impl fmt::Display for Fingerprint {
@@ -79,7 +76,6 @@ impl Fingerprint {
match self {
&Fingerprint::V4(ref fp) => fp,
&Fingerprint::Invalid(ref fp) => fp,
- Fingerprint::__Nonexhaustive => unreachable!(),
}
}
@@ -131,7 +127,6 @@ impl Fingerprint {
let raw = match self {
&Fingerprint::V4(ref fp) => &fp[..],
&Fingerprint::Invalid(ref fp) => &fp[..],
- Fingerprint::__Nonexhaustive => unreachable!(),
};
// We currently only handle V4 fingerprints, which look like: