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

@@ -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 {