forked from Proxmox/proxmox
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.
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Default, Eq, PartialEq)]
|
||||
pub enum Maybe<T> {
|
||||
Explicit(T),
|
||||
Derived(T),
|
||||
#[default]
|
||||
None,
|
||||
}
|
||||
|
||||
impl<T> Default for Maybe<T> {
|
||||
fn default() -> Self {
|
||||
Maybe::None
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Maybe<T> {
|
||||
pub fn as_ref(&self) -> Maybe<&T> {
|
||||
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!
|
||||
#[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")]
|
||||
/// Subscription status
|
||||
pub enum SubscriptionStatus {
|
||||
@ -29,6 +29,7 @@ pub enum SubscriptionStatus {
|
||||
#[serde(alias = "New")]
|
||||
New,
|
||||
/// no subscription set
|
||||
#[default]
|
||||
#[serde(alias = "NotFound")]
|
||||
NotFound,
|
||||
/// subscription set and active
|
||||
@ -44,11 +45,7 @@ pub enum SubscriptionStatus {
|
||||
#[serde(alias = "Suspended")]
|
||||
Suspended,
|
||||
}
|
||||
impl Default for SubscriptionStatus {
|
||||
fn default() -> Self {
|
||||
SubscriptionStatus::NotFound
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for SubscriptionStatus {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
Loading…
Reference in New Issue
Block a user