Skip to content

Commit

Permalink
Clippy fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Apr 12, 2023
1 parent 77fe8cd commit c7790a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mail-parser 0.8.2
================================
- Fix: Parsing address name with \ characters (#41)
- Fix: Missing space when folded header begins with RFC2047 word (#43)
- Fix: Parsing address name with \ characters (#41)
- Fix: Missing space when folded header begins with RFC2047 word (#43)

mail-parser 0.8.1
================================
Expand Down
2 changes: 1 addition & 1 deletion src/decoders/charsets/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn charset_decoder(charset: &[u8]) -> Option<DecoderFnc> {
let mut hash: u32 = charset.len() as u32;

for (pos, ch) in charset.iter().enumerate() {
let ch = if (b'A'..=b'Z').contains(ch) {
let ch = if ch.is_ascii_uppercase() {
*ch + 32
} else {
*ch
Expand Down
18 changes: 4 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,11 @@ pub struct MessagePart<'x> {
}

/// MIME Part encoding type
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
#[repr(u8)]
pub enum Encoding {
#[default]
None = 0,
QuotedPrintable = 1,
Base64 = 2,
Expand All @@ -323,12 +324,6 @@ impl From<u8> for Encoding {
}
}

impl Default for Encoding {
fn default() -> Self {
Encoding::None
}
}

/// Unique ID representing a MIME part within a message.
pub type MessagePartId = usize;

Expand Down Expand Up @@ -714,7 +709,7 @@ impl Display for RfcHeader {
}

/// Parsed header value.
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone, Default)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub enum HeaderValue<'x> {
/// Single address
Expand All @@ -741,15 +736,10 @@ pub enum HeaderValue<'x> {
/// Content-Type or Content-Disposition header
ContentType(ContentType<'x>),

#[default]
Empty,
}

impl<'x> Default for HeaderValue<'x> {
fn default() -> Self {
HeaderValue::Empty
}
}

impl<'x> HeaderValue<'x> {
pub fn is_empty(&self) -> bool {
*self == HeaderValue::Empty
Expand Down
9 changes: 2 additions & 7 deletions src/parsers/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::MessageStream;

const MAX_NESTED_ENCODED: usize = 3;

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Default)]
enum MimeType {
MultipartMixed,
MultipartAlernative,
Expand All @@ -31,16 +31,11 @@ enum MimeType {
TextHtml,
TextOther,
Inline,
#[default]
Message,
Other,
}

impl Default for MimeType {
fn default() -> Self {
MimeType::Message
}
}

#[inline(always)]
fn mime_type(
content_type: Option<&ContentType>,
Expand Down

0 comments on commit c7790a8

Please sign in to comment.