Skip to content

Commit

Permalink
chore(clippy): fix some pedantic lints
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Nov 22, 2024
1 parent 265c936 commit 24baf67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/body/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn encode(b: &[u8], w: &mut dyn Write) -> fmt::Result {
while let Some(chunk) = chunks.next() {
let len = ::base64::engine::general_purpose::STANDARD
.encode_slice(chunk, &mut buf)
.unwrap();
.expect("base64 output `buf` is not big enough");

w.write_str(str::from_utf8(&buf[..len]).expect("base64 produced an invalid encode"))?;
if chunks.peek().is_some() {
Expand Down
2 changes: 1 addition & 1 deletion src/headers/rfc2047.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn encode(mut s: &str, w: &mut EmailWriter<'_>) -> fmt::Result {

// No space remaining, but going to a new line will require us
// to introduce a new space, which will mess up things even more.
word = &s[..s.chars().next().unwrap().len_utf8()];
word = &s[..s.chars().next().expect("`s` is empty").len_utf8()];
}

// Write the prefix
Expand Down
20 changes: 10 additions & 10 deletions src/headers/rfc2231.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ pub fn encode(key: &str, mut value: &str, w: &mut EmailWriter<'_>) -> fmt::Resul

w.write_char('"')?;

if !value.is_empty() {
// End of line
w.write_char(';')?;
w.new_line()?;
} else {
if value.is_empty() {
// End of value
break;
}

// End of line
w.write_char(';')?;
w.new_line()?;

i += 1;
}
}
Expand Down Expand Up @@ -144,15 +144,15 @@ pub fn encode(key: &str, mut value: &str, w: &mut EmailWriter<'_>) -> fmt::Resul
}
}

if !value.is_empty() {
// End of line
w.write_char(';')?;
w.new_line()?;
} else {
if value.is_empty() {
// End of value
break;
}

// End of line
w.write_char(';')?;
w.new_line()?;

i += 1;
}
}
Expand Down

0 comments on commit 24baf67

Please sign in to comment.