From b79a4c48c3bb28f13c6cc8287952085a7c27e87f Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 21 Feb 2020 11:23:07 +0100 Subject: openpgp: Mark enum SymmetricAlgorithm as non-exhaustive. --- openpgp/src/types/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'openpgp/src') diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index 51b7273d..7a4c7451 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -399,6 +399,10 @@ pub enum SymmetricAlgorithm { Private(u8), /// Unknown algorithm identifier. Unknown(u8), + + /// This marks this enum as non-exhaustive. Do not use this + /// variant. + #[doc(hidden)] __Nonexhaustive, } impl Default for SymmetricAlgorithm { @@ -417,6 +421,7 @@ impl SymmetricAlgorithm { => true, Unencrypted | IDEA | Private(_) | Unknown(_) => false, + __Nonexhaustive => unreachable!(), } } } @@ -459,6 +464,7 @@ impl From for u8 { SymmetricAlgorithm::Camellia256 => 13, SymmetricAlgorithm::Private(u) => u, SymmetricAlgorithm::Unknown(u) => u, + SymmetricAlgorithm::__Nonexhaustive => unreachable!(), } } } @@ -494,6 +500,7 @@ impl fmt::Display for SymmetricAlgorithm { f.write_fmt(format_args!("Private/Experimental symmetric key algorithm {}", u)), SymmetricAlgorithm::Unknown(u) => f.write_fmt(format_args!("Unknown symmetric key algorithm {}", u)), + SymmetricAlgorithm::__Nonexhaustive => unreachable!(), } } } -- cgit v1.2.3