[pbs-devel] [PATCH proxmox 10/19] acme/auth-api: add `Default` for types with un-parameterized `new()`

Shannon Sterz s.sterz at proxmox.com
Thu Mar 6 13:43:40 CET 2025


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 <s.sterz at proxmox.com>
---
 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<VerificationKey>,
 }
 
+impl Default for Keyring {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
 impl Keyring {
     pub fn generate_new_rsa() -> Result<Self, Error> {
         PrivateKey::generate_rsa().map(Self::with_private_key)
-- 
2.39.5





More information about the pbs-devel mailing list