mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 11:38:48 +00:00
clippy fix: this (Default) impl
can be derived
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
6f9cc14b9e
commit
268fcfb43a
@ -623,19 +623,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to distinguish between explicitly set or derived data.
|
/// Helper to distinguish between explicitly set or derived data.
|
||||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
#[derive(Clone, Copy, Default, Eq, PartialEq)]
|
||||||
pub enum Maybe<T> {
|
pub enum Maybe<T> {
|
||||||
Explicit(T),
|
Explicit(T),
|
||||||
Derived(T),
|
Derived(T),
|
||||||
|
#[default]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Default for Maybe<T> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Maybe::None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Maybe<T> {
|
impl<T> Maybe<T> {
|
||||||
pub fn as_ref(&self) -> Maybe<&T> {
|
pub fn as_ref(&self) -> Maybe<&T> {
|
||||||
match self {
|
match self {
|
||||||
|
@ -20,7 +20,7 @@ pub(crate) const SUBSCRIPTION_MAX_KEY_CHECK_FAILURE_AGE: i64 = 5 * 24 * 3600;
|
|||||||
|
|
||||||
// Aliases are needed for PVE compat!
|
// Aliases are needed for PVE compat!
|
||||||
#[cfg_attr(feature = "api-types", api())]
|
#[cfg_attr(feature = "api-types", api())]
|
||||||
#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
/// Subscription status
|
/// Subscription status
|
||||||
pub enum SubscriptionStatus {
|
pub enum SubscriptionStatus {
|
||||||
@ -29,6 +29,7 @@ pub enum SubscriptionStatus {
|
|||||||
#[serde(alias = "New")]
|
#[serde(alias = "New")]
|
||||||
New,
|
New,
|
||||||
/// no subscription set
|
/// no subscription set
|
||||||
|
#[default]
|
||||||
#[serde(alias = "NotFound")]
|
#[serde(alias = "NotFound")]
|
||||||
NotFound,
|
NotFound,
|
||||||
/// subscription set and active
|
/// subscription set and active
|
||||||
@ -44,11 +45,7 @@ pub enum SubscriptionStatus {
|
|||||||
#[serde(alias = "Suspended")]
|
#[serde(alias = "Suspended")]
|
||||||
Suspended,
|
Suspended,
|
||||||
}
|
}
|
||||||
impl Default for SubscriptionStatus {
|
|
||||||
fn default() -> Self {
|
|
||||||
SubscriptionStatus::NotFound
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::fmt::Display for SubscriptionStatus {
|
impl std::fmt::Display for SubscriptionStatus {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
Loading…
Reference in New Issue
Block a user