diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-09-22 00:45:53 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-11-06 09:46:53 +0100 |
commit | cdc9e16fb2aef0156d6af4abe3e519c22efa230e (patch) | |
tree | f4f5e10029ed7816bcb0931c53d27ed0e21c598c /openpgp/src/crypto/backend/nettle | |
parent | 327a987e2c95ea9d05fcadd6fa7a8c249372affd (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/crypto/backend/nettle')
-rw-r--r-- | openpgp/src/crypto/backend/nettle/ecdh.rs | 2 | ||||
-rw-r--r-- | openpgp/src/crypto/backend/nettle/hash.rs | 3 | ||||
-rw-r--r-- | openpgp/src/crypto/backend/nettle/symmetric.rs | 3 |
3 files changed, 1 insertions, 7 deletions
diff --git a/openpgp/src/crypto/backend/nettle/ecdh.rs b/openpgp/src/crypto/backend/nettle/ecdh.rs index 29e3d448..93d22a07 100644 --- a/openpgp/src/crypto/backend/nettle/ecdh.rs +++ b/openpgp/src/crypto/backend/nettle/ecdh.rs @@ -109,8 +109,6 @@ pub fn encrypt<R>(recipient: &Key<key::PublicParts, R>, // N/A Curve::Unknown(_) | Curve::Ed25519 => Err(Error::UnsupportedEllipticCurve(curve.clone()).into()), - - Curve::__Nonexhaustive => unreachable!(), } } else { Err(Error::InvalidArgument("Expected an ECDHPublicKey".into()).into()) diff --git a/openpgp/src/crypto/backend/nettle/hash.rs b/openpgp/src/crypto/backend/nettle/hash.rs index b4600b14..bf1d9cb5 100644 --- a/openpgp/src/crypto/backend/nettle/hash.rs +++ b/openpgp/src/crypto/backend/nettle/hash.rs @@ -29,7 +29,6 @@ impl HashAlgorithm { HashAlgorithm::MD5 => true, HashAlgorithm::Private(_) => false, HashAlgorithm::Unknown(_) => false, - HashAlgorithm::__Nonexhaustive => unreachable!(), } } @@ -60,7 +59,6 @@ impl HashAlgorithm { HashAlgorithm::RipeMD => Ok(Box::new(Ripemd160::default())), HashAlgorithm::Private(_) | HashAlgorithm::Unknown(_) => Err(Error::UnsupportedHashAlgorithm(self).into()), - HashAlgorithm::__Nonexhaustive => unreachable!(), } } @@ -78,7 +76,6 @@ impl HashAlgorithm { HashAlgorithm::RipeMD => Ok(rsa::ASN1_OID_RIPEMD160), HashAlgorithm::Private(_) | HashAlgorithm::Unknown(_) => Err(Error::UnsupportedHashAlgorithm(self).into()), - HashAlgorithm::__Nonexhaustive => unreachable!(), } } } diff --git a/openpgp/src/crypto/backend/nettle/symmetric.rs b/openpgp/src/crypto/backend/nettle/symmetric.rs index 4883a5a1..f25bcd7e 100644 --- a/openpgp/src/crypto/backend/nettle/symmetric.rs +++ b/openpgp/src/crypto/backend/nettle/symmetric.rs @@ -58,7 +58,6 @@ impl SymmetricAlgorithm { => true, Unencrypted | IDEA | Private(_) | Unknown(_) => false, - __Nonexhaustive => unreachable!(), } } @@ -246,4 +245,4 @@ impl SymmetricAlgorithm { _ => Err(Error::UnsupportedSymmetricAlgorithm(self).into()), } } -}
\ No newline at end of file +} |