mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
Derive Default where possible
This commit is contained in:
@@ -981,6 +981,7 @@ impl Message {
|
||||
/// For outgoing message, the message could be pending, already delivered or confirmed.
|
||||
#[derive(
|
||||
Debug,
|
||||
Default,
|
||||
Clone,
|
||||
Copy,
|
||||
PartialEq,
|
||||
@@ -997,6 +998,7 @@ impl Message {
|
||||
#[repr(u32)]
|
||||
pub enum MessageState {
|
||||
/// Undefined message state.
|
||||
#[default]
|
||||
Undefined = 0,
|
||||
|
||||
/// Incoming *fresh* message. Fresh messages are neither noticed
|
||||
@@ -1039,12 +1041,6 @@ pub enum MessageState {
|
||||
OutMdnRcvd = 28,
|
||||
}
|
||||
|
||||
impl Default for MessageState {
|
||||
fn default() -> Self {
|
||||
MessageState::Undefined
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for MessageState {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
@@ -1914,6 +1910,7 @@ pub(crate) async fn rfc724_mid_exists(
|
||||
/// How a message is primarily displayed.
|
||||
#[derive(
|
||||
Debug,
|
||||
Default,
|
||||
Display,
|
||||
Clone,
|
||||
Copy,
|
||||
@@ -1929,6 +1926,7 @@ pub(crate) async fn rfc724_mid_exists(
|
||||
#[repr(u32)]
|
||||
pub enum Viewtype {
|
||||
/// Unknown message type.
|
||||
#[default]
|
||||
Unknown = 0,
|
||||
|
||||
/// Text message.
|
||||
@@ -1982,12 +1980,6 @@ pub enum Viewtype {
|
||||
Webxdc = 80,
|
||||
}
|
||||
|
||||
impl Default for Viewtype {
|
||||
fn default() -> Self {
|
||||
Viewtype::Unknown
|
||||
}
|
||||
}
|
||||
|
||||
impl Viewtype {
|
||||
/// Whether a message with this [`Viewtype`] should have a file attachment.
|
||||
pub fn has_file(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user