summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-20 19:26:48 +0300
committerLars Wirzenius <liw@liw.fi>2021-09-21 09:56:49 +0300
commit7febc9e2722f7ca97be91dc4a68c9f6a0502dc27 (patch)
tree9159e67837902e39cd251c777f66c23789920ca2
parenteff8edd82629a4e6151d4bcb104a7695c6975e8d (diff)
Avoid matching on &Foo, when a plain Foo pattern works
The extra & in a pattern (match arm or if let) is unnecessary and only makes the code harder to read. In most places it's enough to just remove the & from the pattern, but in a few places a dereference (*) needs to be added where the value captured in the pattern is used, as removing the & changes the type of the captured value to be a reference. Overall, the changes are almost mechanical. Although the diff is huge, it should be easy to read. The clippy lint match_ref_pats warns about this. See: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
-rw-r--r--ffi-macros/src/rust2c.rs2
-rw-r--r--ffi/src/error.rs56
-rw-r--r--ipc/src/core.rs6
-rw-r--r--net/src/lib.rs16
-rw-r--r--openpgp-ffi/src/error.rs56
-rw-r--r--openpgp-ffi/src/packet/skesk.rs2
-rw-r--r--openpgp-ffi/src/packet/user_attribute.rs2
-rw-r--r--openpgp-ffi/src/packet/userid.rs12
-rw-r--r--openpgp/src/armor.rs10
-rw-r--r--openpgp/src/cert/parser/low_level/lexer.rs18
-rw-r--r--openpgp/src/crypto/backend/nettle/ecdh.rs2
-rw-r--r--openpgp/src/crypto/ecdh.rs2
-rw-r--r--openpgp/src/crypto/mpi.rs64
-rw-r--r--openpgp/src/fingerprint.rs8
-rw-r--r--openpgp/src/keyid.rs8
-rw-r--r--openpgp/src/message/mod.rs2
-rw-r--r--openpgp/src/packet/mod.rs122
-rw-r--r--openpgp/src/packet/skesk.rs4
-rw-r--r--openpgp/src/packet/tag.rs42
-rw-r--r--openpgp/src/parse.rs15
-rw-r--r--openpgp/src/serialize.rs286
-rw-r--r--openpgp/src/types/mod.rs32
-rw-r--r--store/src/backend/mod.rs40
23 files changed, 406 insertions, 401 deletions
diff --git a/ffi-macros/src/rust2c.rs b/ffi-macros/src/rust2c.rs
index f4595813..97ad2b53 100644
--- a/ffi-macros/src/rust2c.rs
+++ b/ffi-macros/src/rust2c.rs
@@ -152,7 +152,7 @@ pub fn rust2c(fun: &syn::ItemFn) -> String {
}
match arg {
- &syn::FnArg::Typed(ref cap) => {
+ syn::FnArg::Typed(ref cap) => {
let pat_ident = match *cap.pat {
syn::Pat::Ident(ref i) => i,
_ => unimplemented!(),
diff --git a/ffi/src/error.rs b/ffi/src/error.rs
index dc4ab474..003477dd 100644
--- a/ffi/src/error.rs
+++ b/ffi/src/error.rs
@@ -28,63 +28,63 @@ impl<'a> FromSequoiaError<'a> for Status {
if let Some(e) = e.downcast_ref::<openpgp::Error>() {
return match e {
- &openpgp::Error::InvalidArgument(_) =>
+ openpgp::Error::InvalidArgument(_) =>
Status::InvalidArgument,
- &openpgp::Error::InvalidOperation(_) =>
+ openpgp::Error::InvalidOperation(_) =>
Status::InvalidOperation,
- &openpgp::Error::MalformedPacket(_) =>
+ openpgp::Error::MalformedPacket(_) =>
Status::MalformedPacket,
- &openpgp::Error::PacketTooLarge(_, _, _) =>
+ openpgp::Error::PacketTooLarge(_, _, _) =>
Status::PacketTooLarge,
- &openpgp::Error::UnsupportedPacketType(_) =>
+ openpgp::Error::UnsupportedPacketType(_) =>
Status::UnsupportedPacketType,
- &openpgp::Error::UnsupportedHashAlgorithm(_) =>
+ openpgp::Error::UnsupportedHashAlgorithm(_) =>
Status::UnsupportedHashAlgorithm,
- &openpgp::Error::UnsupportedPublicKeyAlgorithm(_) =>
+ openpgp::Error::UnsupportedPublicKeyAlgorithm(_) =>
Status::UnsupportedPublicKeyAlgorithm,
- &openpgp::Error::UnsupportedEllipticCurve(_) =>
+ openpgp::Error::UnsupportedEllipticCurve(_) =>
Status::UnsupportedEllipticCurve,
- &openpgp::Error::UnsupportedSymmetricAlgorithm(_) =>
+ openpgp::Error::UnsupportedSymmetricAlgorithm(_) =>
Status::UnsupportedSymmetricAlgorithm,
- &openpgp::Error::UnsupportedAEADAlgorithm(_) =>
+ openpgp::Error::UnsupportedAEADAlgorithm(_) =>
Status::UnsupportedAEADAlgorithm,
- &openpgp::Error::UnsupportedCompressionAlgorithm(_) =>
+ openpgp::Error::UnsupportedCompressionAlgorithm(_) =>
Status::UnsupportedCompressionAlgorithm,
- &openpgp::Error::UnsupportedSignatureType(_) =>
+ openpgp::Error::UnsupportedSignatureType(_) =>
Status::UnsupportedSignatureType,
- &openpgp::Error::InvalidPassword =>
+ openpgp::Error::InvalidPassword =>
Status::InvalidPassword,
- &openpgp::Error::InvalidSessionKey(_) =>
+ openpgp::Error::InvalidSessionKey(_) =>
Status::InvalidSessionKey,
- &openpgp::Error::MissingSessionKey(_) =>
+ openpgp::Error::MissingSessionKey(_) =>
Status::MissingSessionKey,
- &openpgp::Error::MalformedMPI(_) =>
+ openpgp::Error::MalformedMPI(_) =>
Status::MalformedMPI,
- &openpgp::Error::BadSignature(_) =>
+ openpgp::Error::BadSignature(_) =>
Status::BadSignature,
- &openpgp::Error::ManipulatedMessage =>
+ openpgp::Error::ManipulatedMessage =>
Status::ManipulatedMessage,
- &openpgp::Error::MalformedMessage(_) =>
+ openpgp::Error::MalformedMessage(_) =>
Status::MalformedMessage,
- &openpgp::Error::MalformedCert(_) =>
+ openpgp::Error::MalformedCert(_) =>
Status::MalformedCert,
- &openpgp::Error::IndexOutOfRange =>
+ openpgp::Error::IndexOutOfRange =>
Status::IndexOutOfRange,
- &openpgp::Error::UnsupportedCert(_) =>
+ openpgp::Error::UnsupportedCert(_) =>
Status::UnsupportedCert,
- &openpgp::Error::Expired(_) =>
+ openpgp::Error::Expired(_) =>
Status::Expired,
- &openpgp::Error::NotYetLive(_) =>
+ openpgp::Error::NotYetLive(_) =>
Status::NotYetLive,
- &openpgp::Error::NoBindingSignature(_) =>
+ openpgp::Error::NoBindingSignature(_) =>
Status::NoBindingSignature,
- &openpgp::Error::InvalidKey(_) =>
+ openpgp::Error::InvalidKey(_) =>
Status::InvalidKey,
- &openpgp::Error::PolicyViolation(_, _) =>
+ openpgp::Error::PolicyViolation(_, _) =>
Status::PolicyViolation,
// openpgp::Error is non_exhaustive, match on &_ to handle
// future additions.
- &_ => Status::UnknownError
+ _ => Status::UnknownError
}
}
diff --git a/ipc/src/core.rs b/ipc/src/core.rs
index d6895e01..b4dd928a 100644
--- a/ipc/src/core.rs
+++ b/ipc/src/core.rs
@@ -291,9 +291,9 @@ pub enum IPCPolicy {
impl<'a> From<&'a IPCPolicy> for u8 {
fn from(policy: &IPCPolicy) -> Self {
match policy {
- &IPCPolicy::External => 0,
- &IPCPolicy::Internal => 1,
- &IPCPolicy::Robust => 2,
+ IPCPolicy::External => 0,
+ IPCPolicy::Internal => 1,
+ IPCPolicy::Robust => 2,
}
}
}
diff --git a/net/src/lib.rs b/net/src/lib.rs
index c6eaf0a3..74f0ecfb 100644
--- a/net/src/lib.rs
+++ b/net/src/lib.rs
@@ -92,10 +92,10 @@ pub enum Policy {
impl fmt::Display for Policy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", match self {
- &Policy::Offline => "Offline",
- &Policy::Anonymized => "Anonymized",
- &Policy::Encrypted => "Encrypted",
- &Policy::Insecure => "Insecure",
+ Policy::Offline => "Offline",
+ Policy::Anonymized => "Anonymized",
+ Policy::Encrypted => "Encrypted",
+ Policy::Insecure => "Insecure",
})
}
}
@@ -115,10 +115,10 @@ impl Policy {
impl<'a> From<&'a Policy> for u8 {
fn from(policy: &Policy) -> Self {
match policy {
- &Policy::Offline => 0,
- &Policy::Anonymized => 1,
- &Policy::Encrypted => 2,
- &Policy::Insecure => 3,
+ Policy::Offline => 0,
+ Policy::Anonymized => 1,
+ Policy::Encrypted => 2,
+ Policy::Insecure => 3,
}
}
}
diff --git a/openpgp-ffi/src/error.rs b/openpgp-ffi/src/error.rs
index 04bb05c0..1709e1c9 100644
--- a/openpgp-ffi/src/error.rs
+++ b/openpgp-ffi/src/error.rs
@@ -211,63 +211,63 @@ impl<'a> From<&'a anyhow::Error> for Status {
fn from(e: &'a anyhow::Error) -> Self {
if let Some(e) = e.downcast_ref::<openpgp::Error>() {
return match e {
- &openpgp::Error::InvalidArgument(_) =>
+ openpgp::Error::InvalidArgument(_) =>
Status::InvalidArgument,
- &openpgp::Error::InvalidOperation(_) =>
+ openpgp::Error::InvalidOperation(_) =>
Status::InvalidOperation,
- &openpgp::Error::MalformedPacket(_) =>
+ openpgp::Error::MalformedPacket(_) =>
Status::MalformedPacket,
- &openpgp::Error::PacketTooLarge(_, _, _) =>
+ openpgp::Error::PacketTooLarge(_, _, _) =>
Status::PacketTooLarge,
- &openpgp::Error::UnsupportedPacketType(_) =>
+ openpgp::Error::UnsupportedPacketType(_) =>
Status::UnsupportedPacketType,
- &openpgp::Error::UnsupportedHashAlgorithm(_) =>
+ openpgp::Error::UnsupportedHashAlgorithm(_) =>
Status::UnsupportedHashAlgorithm,
- &openpgp::Error::UnsupportedPublicKeyAlgorithm(_) =>
+ openpgp::Error::UnsupportedPublicKeyAlgorithm(_) =>
Status::UnsupportedPublicKeyAlgorithm,
- &openpgp::Error::UnsupportedEllipticCurve(_) =>
+ openpgp::Error::UnsupportedEllipticCurve(_) =>
Status::UnsupportedEllipticCurve,
- &openpgp::Error::UnsupportedSymmetricAlgorithm(_) =>
+ openpgp::Error::UnsupportedSymmetricAlgorithm(_) =>
Status::UnsupportedSymmetricAlgorithm,
- &openpgp::Error::UnsupportedAEADAlgorithm(_) =>
+ openpgp::Error::UnsupportedAEADAlgorithm(_) =>
Status::UnsupportedAEADAlgorithm,
- &openpgp::Error::UnsupportedCompressionAlgorithm(_) =>
+ openpgp::Error::UnsupportedCompressionAlgorithm(_) =>
Status::UnsupportedCompressionAlgorithm,
- &openpgp::Error::UnsupportedSignatureType(_) =>
+ openpgp::Error::UnsupportedSignatureType(_) =>
Status::UnsupportedSignatureType,
- &openpgp::Error::InvalidPassword =>
+ openpgp::Error::InvalidPassword =>
Status::InvalidPassword,
- &openpgp::Error::InvalidSessionKey(_) =>
+ openpgp::Error::InvalidSessionKey(_) =>
Status::InvalidSessionKey,
- &openpgp::Error::MissingSessionKey(_) =>
+ openpgp::Error::MissingSessionKey(_) =>
Status::MissingSessionKey,
- &openpgp::Error::MalformedMPI(_) =>
+ openpgp::Error::MalformedMPI(_) =>
Status::MalformedMPI,
- &openpgp::Error::BadSignature(_) =>
+ openpgp::Error::BadSignature(_) =>
Status::BadSignature,
- &openpgp::Error::ManipulatedMessage =>
+ openpgp::Error::ManipulatedMessage =>
Status::ManipulatedMessage,
- &openpgp::Error::MalformedMessage(_) =>
+ openpgp::Error::MalformedMessage(_) =>
Status::MalformedMessage,
- &openpgp::Error::MalformedCert(_) =>
+ openpgp::Error::MalformedCert(_) =>
Status::MalformedCert,
- &openpgp::Error::IndexOutOfRange =>
+ openpgp::Error::IndexOutOfRange =>
Status::IndexOutOfRange,
- &openpgp::Error::UnsupportedCert(_) =>
+ openpgp::Error::UnsupportedCert(_) =>
Status::UnsupportedCert,
- &openpgp::Error::Expired(_) =>
+ openpgp::Error::Expired(_) =>
Status::Expired,
- &openpgp::Error::NotYetLive(_) =>
+ openpgp::Error::NotYetLive(_) =>
Status::NotYetLive,
- &openpgp::Error::NoBindingSignature(_) =>
+ openpgp::Error::NoBindingSignature(_) =>
Status::NoBindingSignature,
- &openpgp::Error::InvalidKey(_) =>
+ openpgp::Error::InvalidKey(_) =>
Status::InvalidKey,
- &openpgp::Error::PolicyViolation(_, _) =>
+ openpgp::Error::PolicyViolation(_, _) =>
Status::PolicyViolation,
// openpgp::Error is non_exhaustive, match on &_ to handle
// future additions.
- &_ => Status::UnknownError
+ _ => Status::UnknownError
}
}
diff --git a/openpgp-ffi/src/packet/skesk.rs b/openpgp-ffi/src/packet/skesk.rs
index ddc41e1c..a6e9bdfb 100644
--- a/openpgp-ffi/src/packet/skesk.rs
+++ b/openpgp-ffi/src/packet/skesk.rs
@@ -32,7 +32,7 @@ pub extern "C" fn pgp_skesk_decrypt(errp: Option<&mut *mut crate::error::Error>,
let algo = ffi_param_ref_mut!(algo);
let key_len = ffi_param_ref_mut!(key_len);
- if let &openpgp::Packet::SKESK(ref skesk) = skesk.ref_raw() {
+ if let openpgp::Packet::SKESK(ref skesk) = skesk.ref_raw() {
match skesk.decrypt(&password.to_owned().into()) {
Ok((a, k)) => {
*algo = a.into();
diff --git a/openpgp-ffi/src/packet/user_attribute.rs b/openpgp-ffi/src/packet/user_attribute.rs
index 42e7d156..ad141056 100644
--- a/openpgp-ffi/src/packet/user_attribute.rs
+++ b/openpgp-ffi/src/packet/user_attribute.rs
@@ -18,7 +18,7 @@ use crate::RefRaw;
pub extern "C" fn pgp_user_attribute_value(ua: *const Packet,
value_len: Option<&mut size_t>)
-> *const u8 {
- if let &openpgp::Packet::UserAttribute(ref ua) = ua.ref_raw() {
+ if let openpgp::Packet::UserAttribute(ref ua) = ua.ref_raw() {
if let Some(p) = value_len {
*p = ua.value().len();
}
diff --git a/openpgp-ffi/src/packet/userid.rs b/openpgp-ffi/src/packet/userid.rs
index 89febc06..db0f731b 100644
--- a/openpgp-ffi/src/packet/userid.rs
+++ b/openpgp-ffi/src/packet/userid.rs
@@ -129,7 +129,7 @@ pub extern "C"
fn pgp_user_id_value(uid: *const Packet, value_len: Option<&mut size_t>)
-> *const u8
{
- if let &openpgp::Packet::UserID(ref uid) = uid.ref_raw() {
+ if let openpgp::Packet::UserID(ref uid) = uid.ref_raw() {
if let Some(p) = value_len {
*p = uid.value().len();
}
@@ -158,7 +158,7 @@ fn pgp_user_id_name(
ffi_make_fry_from_errp!(errp);
let uid = uid.ref_raw();
- if let &openpgp::Packet::UserID(ref uid) = uid {
+ if let openpgp::Packet::UserID(ref uid) = uid {
match uid.name() {
Ok(Some(name)) =>
*namep = ffi_return_string!(name),
@@ -199,7 +199,7 @@ fn pgp_user_id_comment(
ffi_make_fry_from_errp!(errp);
let uid = uid.ref_raw();
- if let &openpgp::Packet::UserID(ref uid) = uid {
+ if let openpgp::Packet::UserID(ref uid) = uid {
match uid.comment() {
Ok(Some(comment)) =>
*commentp = ffi_return_string!(comment),
@@ -240,7 +240,7 @@ fn pgp_user_id_email(
ffi_make_fry_from_errp!(errp);
let uid = uid.ref_raw();
- if let &openpgp::Packet::UserID(ref uid) = uid {
+ if let openpgp::Packet::UserID(ref uid) = uid {
match uid.email() {
Ok(Some(address)) =>
*addressp = ffi_return_string!(address),
@@ -280,7 +280,7 @@ fn pgp_user_id_uri(
ffi_make_fry_from_errp!(errp);
let uid = uid.ref_raw();
- if let &openpgp::Packet::UserID(ref uid) = uid {
+ if let openpgp::Packet::UserID(ref uid) = uid {
match uid.uri() {
Ok(Some(uri)) =>
*urip = ffi_return_string!(uri),
@@ -330,7 +330,7 @@ fn pgp_user_id_email_normalized(
ffi_make_fry_from_errp!(errp);
let uid = uid.ref_raw();
- if let &openpgp::Packet::UserID(ref uid) = uid {
+ if let openpgp::Packet::UserID(ref uid) = uid {
match uid.email_normalized() {
Ok(Some(email)) =>
*emailp = ffi_return_string!(email),
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index 7f35a804..851408a2 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -211,11 +211,11 @@ impl Kind {
fn blurb(&self) -> &str {
match self {
- &Kind::Message => "MESSAGE",
- &Kind::PublicKey => "PUBLIC KEY BLOCK",
- &Kind::SecretKey => "PRIVATE KEY BLOCK",
- &Kind::Signature => "SIGNATURE",
- &Kind::File => "ARMORED FILE",
+ Kind::Message => "MESSAGE",
+ Kind::PublicKey => "PUBLIC KEY BLOCK",
+ Kind::SecretKey => "PRIVATE KEY BLOCK",
+ Kind::Signature => "SIGNATURE",
+ Kind::File => "ARMORED FILE",
}
}
diff --git a/openpgp/src/cert/parser/low_level/lexer.rs b/openpgp/src/cert/parser/low_level/lexer.rs
index a8fad2e8..1a698579 100644
--- a/openpgp/src/cert/parser/low_level/lexer.rs
+++ b/openpgp/src/cert/parser/low_level/lexer.rs
@@ -64,15 +64,15 @@ assert_send_and_sync!(Component);
impl<'a> From<&'a Token> for Tag {
fn from(token: &'a Token) -> Self {
match token {
- &Token::PublicKey(_) => Tag::PublicKey,
- &Token::SecretKey(_) => Tag::SecretKey,
- &Token::PublicSubkey(_) => Tag::PublicSubkey,
- &Token::SecretSubkey(_) => Tag::SecretSubkey,
- &Token::UserID(_) => Tag::UserID,
- &Token::UserAttribute(_) => Tag::UserAttribute,
- &Token::Signature(_) => Tag::Signature,
- &Token::Trust(_) => Tag::Trust,
- &Token::Unknown(tag, _) => tag,
+ Token::PublicKey(_) => Tag::PublicKey,
+ Token::SecretKey(_) => Tag::SecretKey,
+ Token::PublicSubkey(_) => Tag::PublicSubkey,
+ Token::SecretSubkey(_) => Tag::SecretSubkey,
+ Token::UserID(_) => Tag::UserID,
+ Token::UserAttribute(_) => Tag::UserAttribute,
+ Token::Signature(_) => Tag::Signature,
+ Token::Trust(_) => Tag::Trust,
+ Token::Unknown(tag, _) => *tag,
}
}
}
diff --git a/openpgp/src/crypto/backend/nettle/ecdh.rs b/openpgp/src/crypto/backend/nettle/ecdh.rs
index c26a843b..af1a7220 100644
--- a/openpgp/src/crypto/backend/nettle/ecdh.rs
+++ b/openpgp/src/crypto/backend/nettle/ecdh.rs
@@ -19,7 +19,7 @@ pub fn encrypt<R>(recipient: &Key<key::PublicParts, R>,
{
let mut rng = Yarrow::default();
- if let &PublicKey::ECDH {
+ if let PublicKey::ECDH {
ref curve, ref q,..
} = recipient.mpis() {
match curve {
diff --git a/openpgp/src/crypto/ecdh.rs b/openpgp/src/crypto/ecdh.rs
index c49807f5..3407e8a3 100644
--- a/openpgp/src/crypto/ecdh.rs
+++ b/openpgp/src/crypto/ecdh.rs
@@ -40,7 +40,7 @@ pub(crate) fn encrypt_wrap<R>(recipient: &Key<key::PublicParts, R>,
where R: key::KeyRole
{
match recipient.mpis() {
- &mpi::PublicKey::ECDH { ref curve, ref hash, ref sym,.. } => {
+ mpi::PublicKey::ECDH { ref curve, ref hash, ref sym,.. } => {
// m = sym_alg_ID || session key || checksum || pkcs5_padding;
let mut m = Vec::with_capacity(40);
m.extend_from_slice(session_key);
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index ae7e9b1b..0bda2b52 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -521,13 +521,13 @@ impl PublicKey {
pub fn bits(&self) -> Option<usize> {
use self::PublicKey::*;
match self {
- &RSA { ref n,.. } => Some(n.bits()),
- &DSA { ref p,.. } => Some(p.bits()),
- &ElGamal { ref p,.. } => Some(p.bits()),
- &EdDSA { ref curve,.. } => curve.bits(),
- &ECDSA { ref curve,.. } => curve.bits(),
- &ECDH { ref curve,.. } => curve.bits(),
- &Unknown { .. } => None,
+ RSA { ref n,.. } => Some(n.bits()),
+ DSA { ref p,.. } => Some(p.bits()),
+ ElGamal { ref p,.. } => Some(p.bits()),
+ EdDSA { ref curve,.. } => curve.bits(),
+ ECDSA { ref curve,.. } => curve.bits(),
+ ECDH { ref curve,.. } => curve.bits(),
+ Unknown { .. } => None,
}
}
@@ -671,36 +671,36 @@ impl fmt::Debug for SecretKeyMaterial {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if cfg!(debug_assertions) {
match self {
- &SecretKeyMaterial::RSA{ ref d, ref p, ref q, ref u } =>
+ SecretKeyMaterial::RSA{ ref d, ref p, ref q, ref u } =>
write!(f, "RSA {{ d: {:?}, p: {:?}, q: {:?}, u: {:?} }}", d, p, q, u),
- &SecretKeyMaterial::DSA{ ref x } =>
+ SecretKeyMaterial::DSA{ ref x } =>
write!(f, "DSA {{ x: {:?} }}", x),
- &SecretKeyMaterial::ElGamal{ ref x } =>
+ SecretKeyMaterial::ElGamal{ ref x } =>
write!(f, "ElGamal {{ x: {:?} }}", x),
- &SecretKeyMaterial::EdDSA{ ref scalar } =>
+ SecretKeyMaterial::EdDSA{ ref scalar } =>
write!(f, "EdDSA {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::ECDSA{ ref scalar } =>
+ SecretKeyMaterial::ECDSA{ ref scalar } =>
write!(f, "ECDSA {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::ECDH{ ref scalar } =>
+ SecretKeyMaterial::ECDH{ ref scalar } =>
write!(f, "ECDH {{ scalar: {:?} }}", scalar),
- &SecretKeyMaterial::Unknown{ ref mpis, ref rest } =>
+ SecretKeyMaterial::Unknown{ ref mpis, ref rest } =>
write!(f, "Unknown {{ mips: {:?}, rest: {:?} }}", mpis, rest),
}
} else {
match self {
- &SecretKeyMaterial::RSA{ .. } =>
+ SecretKeyMaterial::RSA{ .. } =>
f.write_str("RSA { <Redacted> }"),
- &SecretKeyMaterial::DSA{ .. } =>
+ SecretKeyMaterial::DSA{ .. } =>
f.write_str("DSA { <Redacted> }"),
- &SecretKeyMaterial::ElGamal{ .. } =>
+ SecretKeyMaterial::ElGamal{ .. } =>
f.write_str("ElGamal { <Redacted> }"),
- &SecretKeyMaterial::EdDSA{ .. } =>
+ SecretKeyMaterial::EdDSA{ .. } =>
f.write_str("EdDSA { <Redacted> }"),
- &SecretKeyMaterial::ECDSA{ .. } =>
+ SecretKeyMaterial::ECDSA{ .. } =>
f.write_str("ECDSA { <Redacted> }"),
- &SecretKeyMaterial::ECDH{ .. } =>
+ SecretKeyMaterial::ECDH{ .. } =>
f.write_str("ECDH { <Redacted> }"),
- &SecretKeyMaterial::Unknown{ .. } =>
+ SecretKeyMaterial::Unknown{ .. } =>
f.write_str("Unknown { <Redacted> }"),
}
}
@@ -713,13 +713,13 @@ impl PartialOrd for SecretKeyMaterial {
fn discriminant(sk: &SecretKeyMaterial) -> usize {
match sk {
- &SecretKeyMaterial::RSA{ .. } => 0,
- &SecretKeyMaterial::DSA{ .. } => 1,
- &SecretKeyMaterial::ElGamal{ .. } => 2,
-