From d892fd80c322eefb4c1df810423023a04f43fcc2 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Thu, 18 Nov 2021 07:38:27 -0700 Subject: [PATCH] Use `finish_non_exhaustive` in Debug impls Various private key types had TODOs to use it. It was stabilized in Rust 1.53. --- pkcs1/src/private_key.rs | 8 +------- pkcs8/src/encrypted_private_key_info.rs | 2 +- pkcs8/src/private_key_info.rs | 2 +- sec1/src/private_key.rs | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pkcs1/src/private_key.rs b/pkcs1/src/private_key.rs index e44b75c1d..8a87dd747 100644 --- a/pkcs1/src/private_key.rs +++ b/pkcs1/src/private_key.rs @@ -184,13 +184,7 @@ impl<'a> fmt::Debug for RsaPrivateKey<'a> { .field("version", &self.version()) .field("modulus", &self.modulus) .field("public_exponent", &self.public_exponent) - .field("private_exponent", &"...") - .field("prime1", &"...") - .field("prime2", &"...") - .field("exponent1", &"...") - .field("exponent2", &"...") - .field("coefficient", &"...") - .finish() // TODO: use `finish_non_exhaustive` when stable + .finish_non_exhaustive() } } diff --git a/pkcs8/src/encrypted_private_key_info.rs b/pkcs8/src/encrypted_private_key_info.rs index 101892d97..630cdb49d 100644 --- a/pkcs8/src/encrypted_private_key_info.rs +++ b/pkcs8/src/encrypted_private_key_info.rs @@ -106,6 +106,6 @@ impl<'a> fmt::Debug for EncryptedPrivateKeyInfo<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("EncryptedPrivateKeyInfo") .field("encryption_algorithm", &self.encryption_algorithm) - .finish() // TODO(tarcieri): use `finish_non_exhaustive` when stable + .finish_non_exhaustive() } } diff --git a/pkcs8/src/private_key_info.rs b/pkcs8/src/private_key_info.rs index abedadcbc..96bac9678 100644 --- a/pkcs8/src/private_key_info.rs +++ b/pkcs8/src/private_key_info.rs @@ -229,7 +229,7 @@ impl<'a> fmt::Debug for PrivateKeyInfo<'a> { .field("version", &self.version()) .field("algorithm", &self.algorithm) .field("public_key", &self.public_key) - .finish() // TODO: use `finish_non_exhaustive` when stable + .finish_non_exhaustive() } } diff --git a/sec1/src/private_key.rs b/sec1/src/private_key.rs index ff8d507ac..17ea57d22 100644 --- a/sec1/src/private_key.rs +++ b/sec1/src/private_key.rs @@ -129,6 +129,6 @@ impl<'a> fmt::Debug for EcPrivateKey<'a> { f.debug_struct("EcPrivateKey") .field("parameters", &self.parameters) .field("public_key", &self.public_key) - .finish() // TODO: use `finish_non_exhaustive` when stable + .finish_non_exhaustive() } }