public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox 1/6] acme: Default `impl` can be derived
@ 2024-02-28 11:39 Maximiliano Sandoval
  2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 2/6] remove needless_borrow Maximiliano Sandoval
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2024-02-28 11:39 UTC (permalink / raw)
  To: pbs-devel

Fixes the clippy lint

    warning: this `impl` can be derived
      --> proxmox-acme/src/order.rs:36:1
       |
    36 | / impl Default for Status {
    37 | |     fn default() -> Self {
    38 | |         Status::New
    39 | |     }
    40 | | }
       | |_^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
       = note: `#[warn(clippy::derivable_impls)]` on by default
       = help: remove the manual implementation...
    help: ...and instead derive it...
       |
    12 + #[derive(Default)]
    13 | pub enum Status {
       |
    help: ...and mark the default variant
       |
    15 ~     #[default]
    16 ~     New,
       |

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxmox-acme/src/order.rs | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/proxmox-acme/src/order.rs b/proxmox-acme/src/order.rs
index 404d4ae7..97c068c4 100644
--- a/proxmox-acme/src/order.rs
+++ b/proxmox-acme/src/order.rs
@@ -7,11 +7,12 @@ use crate::request::Request;
 use crate::Error;
 
 /// Status of an [`Order`].
-#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
+#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
 #[serde(rename_all = "lowercase")]
 pub enum Status {
     /// Invalid, used as a place holder for when sending objects as contrary to account creation,
     /// the Acme RFC does not require the server to ignore unknown parts of the `Order` object.
+    #[default]
     New,
 
     /// Authorization failed and it is now invalid.
@@ -33,12 +34,6 @@ pub enum Status {
     Valid,
 }
 
-impl Default for Status {
-    fn default() -> Self {
-        Status::New
-    }
-}
-
 impl Status {
     /// Serde helper
     fn is_new(&self) -> bool {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-28 11:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28 11:39 [pbs-devel] [PATCH proxmox 1/6] acme: Default `impl` can be derived Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 2/6] remove needless_borrow Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 3/6] io: remove unnecesary cast to *mut u8 Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 4/6] schema: de: don't use while where we don't loop Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 5/6] rest: do not convert string to string Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 6/6] rrd: use unwrap_or_default when possible Maximiliano Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal