summaryrefslogtreecommitdiffstats
path: root/openpgp/src/policy.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/policy.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/policy.rs')
-rw-r--r--openpgp/src/policy.rs7
1 files changed, 1 insertions, 6 deletions
diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs
index fba139da..c247275e 100644
--- a/openpgp/src/policy.rs
+++ b/openpgp/src/policy.rs
@@ -821,7 +821,6 @@ impl<'a> Policy for StandardPolicy<'a> {
Curve::Ed25519 => Cv25519,
Curve::Cv25519 => Cv25519,
Curve::Unknown(_) => Unknown,
- Curve::__Nonexhaustive => unreachable!(),
}
},
@@ -868,6 +867,7 @@ impl<'a> Policy for StandardPolicy<'a> {
///
/// Note: This enum cannot be exhaustively matched to allow future
/// extensions.
+#[non_exhaustive]
#[derive(Clone, Debug)]
pub enum AsymmetricAlgorithm {
/// RSA with key sizes up to 2048-1 bit.
@@ -908,10 +908,6 @@ pub enum AsymmetricAlgorithm {
Cv25519,
/// Unknown algorithm.
Unknown,
-
- /// This marks this enum as non-exhaustive. Do not use this
- /// variant.
- #[doc(hidden)] __Nonexhaustive,
}
impl std::fmt::Display for AsymmetricAlgorithm {
@@ -943,7 +939,6 @@ impl From<AsymmetricAlgorithm> for u8 {
BrainpoolP512 => 16,
Cv25519 => 17,
Unknown => 255,
- __Nonexhaustive => unreachable!(),
}
}
}