Derive Default where possible

This commit is contained in:
link2xt
2023-02-14 20:54:16 +00:00
parent e11d7c0444
commit 05f0fe0a88
11 changed files with 47 additions and 121 deletions

View File

@@ -223,12 +223,24 @@ pub struct Contact {
/// Possible origins of a contact.
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, FromPrimitive, ToPrimitive, FromSql, ToSql,
Debug,
Default,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
Ord,
FromPrimitive,
ToPrimitive,
FromSql,
ToSql,
)]
#[repr(u32)]
pub enum Origin {
/// Unknown origin. Can be used as a minimum origin to specify that the caller does not care
/// about origin of the contact.
#[default]
Unknown = 0,
/// The contact is a mailing list address, needed to unblock mailing lists
@@ -287,12 +299,6 @@ pub enum Origin {
ManuallyCreated = 0x0400_0000,
}
impl Default for Origin {
fn default() -> Self {
Origin::Unknown
}
}
impl Origin {
/// Contacts that are known, i. e. they came in via accepted contacts or
/// themselves an accepted contact. Known contacts are shown in the