From d6b84d3d9d51b088dd672975e68dcbcc286e347a Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 19 Dec 2019 19:12:10 +0100 Subject: [PATCH] Use the non_exhaustive feature in CertificateParams This attribute replaces the _hidden field of the struct, serving the same purpose. For enums, we don't use the non_exhaustive feature yet as we'd like to have exhaustivness checks at least for our internal code. For more, see this comment by @dtolnay [1] It stabilized in Rust 1.40.0 which got released today. The MSRV policy of this crate is to follow whatever the currently latest released Rust version is. [1]: https://github.com/rust-lang/rust/issues/44109#issuecomment-521781237 --- src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d87a3cb3..20d6e406 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -262,6 +262,7 @@ impl <'a> Iterator for DistinguishedNameIterator<'a> { /// Parameters used for certificate generation #[allow(missing_docs)] +#[non_exhaustive] pub struct CertificateParams { pub alg :&'static SignatureAlgorithm, pub not_before :DateTime, @@ -274,8 +275,6 @@ pub struct CertificateParams { pub custom_extensions :Vec, /// The certificate's key pair, a new random key pair will be generated if this is `None` pub key_pair :Option, - // To make the struct non-exhaustive - _hidden :(), } impl Default for CertificateParams { @@ -296,7 +295,6 @@ impl Default for CertificateParams { extended_key_usages : Vec::new(), custom_extensions : Vec::new(), key_pair : None, - _hidden :(), } } }