From ab2d5c9777cc2e36d4f04b7987a5e1a395250df6 Mon Sep 17 00:00:00 2001 From: Shannon Sterz Date: Thu, 6 Mar 2025 13:43:40 +0100 Subject: [PATCH] acme/auth-api: add `Default` for types with un-parameterized `new()` this fixes a clippy lint for types that have a `new()` function that has no parameters [1]. this should allow using these types with functions such as `unwrap_or_default()`. [1]: https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default Signed-off-by: Shannon Sterz --- proxmox-acme/src/types.rs | 6 ++++++ proxmox-auth-api/src/auth_key.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/proxmox-acme/src/types.rs b/proxmox-acme/src/types.rs index e5a6b34d..0ec2deeb 100644 --- a/proxmox-acme/src/types.rs +++ b/proxmox-acme/src/types.rs @@ -38,6 +38,12 @@ pub enum AccountStatus { Revoked, } +impl Default for AccountStatus { + fn default() -> Self { + Self::new() + } +} + impl AccountStatus { /// Create a new instance with state New. #[inline] diff --git a/proxmox-auth-api/src/auth_key.rs b/proxmox-auth-api/src/auth_key.rs index 9873d935..500725d3 100644 --- a/proxmox-auth-api/src/auth_key.rs +++ b/proxmox-auth-api/src/auth_key.rs @@ -237,6 +237,12 @@ pub struct Keyring { public_keys: Vec, } +impl Default for Keyring { + fn default() -> Self { + Self::new() + } +} + impl Keyring { pub fn generate_new_rsa() -> Result { PrivateKey::generate_rsa().map(Self::with_private_key)