summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2021-04-07 17:52:18 +0200
committerNora Widdecke <nora@sequoia-pgp.org>2021-04-09 13:13:59 +0200
commitbaecfecbf953aa9e40f16084b927f35b69efc8f0 (patch)
treebac7c53d32187d6eff22d231dd556b4ada40d50f /openpgp/src/types
parent4d7ecc72b384a9c30e7024eb2ebfaede9882db06 (diff)
Lint: Use matches! macro.
- https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
Diffstat (limited to 'openpgp/src/types')
-rw-r--r--openpgp/src/types/mod.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs
index 12ba45c2..9c33f47a 100644
--- a/openpgp/src/types/mod.rs
+++ b/openpgp/src/types/mod.rs
@@ -145,11 +145,13 @@ impl PublicKeyAlgorithm {
/// ```
pub fn for_signing(&self) -> bool {
use self::PublicKeyAlgorithm::*;
- #[allow(deprecated)]
- match &self {
- RSAEncryptSign | RSASign | DSA | ECDSA | ElGamalEncryptSign
- | EdDSA => true,
- _ => false,
+ #[allow(deprecated)] {
+ matches!(self, RSAEncryptSign
+ | RSASign
+ | DSA
+ | ECDSA
+ | ElGamalEncryptSign
+ | EdDSA)
}
}
@@ -167,11 +169,12 @@ impl PublicKeyAlgorithm {
/// ```
pub fn for_encryption(&self) -> bool {
use self::PublicKeyAlgorithm::*;
- #[allow(deprecated)]
- match &self {
- RSAEncryptSign | RSAEncrypt | ElGamalEncrypt | ECDH
- | ElGamalEncryptSign => true,
- _ => false,
+ #[allow(deprecated)] {
+ matches!(self, RSAEncryptSign
+ | RSAEncrypt
+ | ElGamalEncrypt
+ | ECDH
+ | ElGamalEncryptSign)
}
}