diff --git a/src/configure/auto_mozilla.rs b/src/configure/auto_mozilla.rs index 664334ed9..01cd06fd2 100644 --- a/src/configure/auto_mozilla.rs +++ b/src/configure/auto_mozilla.rs @@ -28,8 +28,9 @@ struct MozAutoconfigure { pub outgoing_servers: Vec, } -#[derive(Debug)] +#[derive(Debug, Default)] enum MozConfigTag { + #[default] Undefined, Hostname, Port, @@ -37,12 +38,6 @@ enum MozConfigTag { Username, } -impl Default for MozConfigTag { - fn default() -> Self { - Self::Undefined - } -} - impl FromStr for MozConfigTag { type Err = (); diff --git a/src/context.rs b/src/context.rs index 5d803599c..4ced437f0 100644 --- a/src/context.rs +++ b/src/context.rs @@ -308,7 +308,7 @@ pub struct InnerContext { } /// The state of ongoing process. -#[derive(Debug)] +#[derive(Debug, Default)] enum RunningState { /// Ongoing process is allocated. Running { cancel_sender: Sender<()> }, @@ -317,15 +317,10 @@ enum RunningState { ShallStop { request: tools::Time }, /// There is no ongoing process, a new one can be allocated. + #[default] Stopped, } -impl Default for RunningState { - fn default() -> Self { - Self::Stopped - } -} - /// Return some info about deltachat-core /// /// This contains information mostly about the library itself, the diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 555447820..3e27e2253 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -88,9 +88,10 @@ use crate::tools::{SystemTime, duration_to_str, time}; use crate::{location, stats}; /// Ephemeral timer value. -#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize, Default)] pub enum Timer { /// Timer is disabled. + #[default] Disabled, /// Timer is enabled. @@ -125,12 +126,6 @@ impl Timer { } } -impl Default for Timer { - fn default() -> Self { - Self::Disabled - } -} - impl fmt::Display for Timer { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.to_u32()) diff --git a/src/message.rs b/src/message.rs index 91374e3cc..702b730dc 100644 --- a/src/message.rs +++ b/src/message.rs @@ -381,9 +381,11 @@ impl rusqlite::types::FromSql for MsgId { ToSql, Serialize, Deserialize, + Default, )] #[repr(u8)] pub(crate) enum MessengerMessage { + #[default] No = 0, Yes = 1, @@ -391,12 +393,6 @@ pub(crate) enum MessengerMessage { Reply = 2, } -impl Default for MessengerMessage { - fn default() -> Self { - Self::No - } -} - /// An object representing a single message in memory. /// The message object is not updated. /// If you want an update, you have to recreate the object.