summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2022-01-06 18:27:25 +0100
committerJustus Winter <justus@sequoia-pgp.org>2022-01-06 18:27:25 +0100
commitdfbc2f8207a9bc3f9faeea2eebdfc39c6ffb91f2 (patch)
treea95a8d15fd9e53534733fe10bcf922ca5a98df75
parentfdec62f32e48111fd2fc837cfb9b7d5a17db9ca6 (diff)
openpgp: Improve S2K::is_supported.
- Use exhaustive match.
-rw-r--r--openpgp/src/crypto/s2k.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs
index 0644816c..c31d6fa2 100644
--- a/openpgp/src/crypto/s2k.rs
+++ b/openpgp/src/crypto/s2k.rs
@@ -243,8 +243,15 @@ impl S2K {
/// Returns whether this S2K mechanism is supported.
pub fn is_supported(&self) -> bool {
use self::S2K::*;
- #[allow(deprecated)] {
- matches!(self, Simple { .. } | Salted { .. } | Iterated { .. })
+ #[allow(deprecated)]
+ match self {
+ Simple { .. }
+ | Salted { .. }
+ | Iterated { .. }
+ => true,
+ S2K::Private { .. }
+ | S2K::Unknown { .. }
+ => false,
}
}