diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-09-25 15:44:20 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-11-06 09:46:53 +0100 |
commit | 31a033b7d19644c1e96512b9f8983b2fd5704503 (patch) | |
tree | 034918375c812c0fd11a9df802b75e9073dc4286 /ipc | |
parent | cdc9e16fb2aef0156d6af4abe3e519c22efa230e (diff) |
ipc: Handle matching on non_exhaustive enums.
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/src/keygrip.rs | 6 | ||||
-rw-r--r-- | ipc/src/sexp.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/ipc/src/keygrip.rs b/ipc/src/keygrip.rs index 148c11d7..6d08f70f 100644 --- a/ipc/src/keygrip.rs +++ b/ipc/src/keygrip.rs @@ -169,12 +169,12 @@ impl Keygrip { &ECDSA { ref curve, ref q } => hash_ecc(&mut hash, curve, q), &ECDH { ref curve, ref q, .. } => hash_ecc(&mut hash, curve, q), - &Unknown { .. } => + // crypto::mpi::PublicKey is non_exhaustive, match on &_ to handle + // future additions. + &Unknown { .. } | &_ => return Err(Error::InvalidOperation( "Keygrip not defined for this kind of public key".into()) .into()), - - &_ => unreachable!(), // Ciphertext is non-exhaustive. } let mut digest = [0; 20]; diff --git a/ipc/src/sexp.rs b/ipc/src/sexp.rs index 1ca36a04..14d3e4c8 100644 --- a/ipc/src/sexp.rs +++ b/ipc/src/sexp.rs @@ -289,12 +289,12 @@ impl TryFrom<&mpi::Ciphertext> for Sexp { Sexp::String("e".into()), Sexp::String(e.value().into())])])])), - &Unknown { .. } => + // crypto::mpi::Ciphertext is non_exhaustive, match on &_ to handle + // future additions. + &Unknown { .. } | &_ => Err(Error::InvalidArgument( format!("Don't know how to convert {:?}", ciphertext)) .into()), - - &_ => unreachable!(), // Ciphertext is non-exhaustive. } } } |