diff options
author | Thomas Hurst <tom@hur.st> | 2018-09-07 02:33:40 +0100 |
---|---|---|
committer | Kartikaya Gupta (kats) <staktrace@users.noreply.github.com> | 2018-09-07 11:51:51 -0400 |
commit | 30baefc366c26a31318fd9053b768fa50616c344 (patch) | |
tree | 8e4bce9e9e0dcf83cd3cd65bcdb04845a3af78ab /src/lib.rs | |
parent | 59a9e608cc6b9ce7af946d9260056a86cbbcfe75 (diff) |
Prefer map_err(|e| e.into()) over explicit error
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -141,7 +141,7 @@ impl<'a> MailHeader<'a> { encoding::all::ISO_8859_1 .decode(self.key, encoding::DecoderTrap::Strict) .map(|s| s.trim().to_string()) - .map_err(MailParseError::EncodingError) + .map_err(|e| e.into()) } fn decode_word(&self, encoded: &str) -> Option<String> { @@ -657,8 +657,8 @@ impl<'a> ParsedMail<'a> { let decoded = self.get_body_raw()?; let charset_conv = encoding::label::encoding_from_whatwg_label(&self.ctype.charset) .unwrap_or(encoding::all::ASCII); - let str_body = charset_conv.decode(&decoded, encoding::DecoderTrap::Replace)?; - Ok(str_body) + charset_conv.decode(&decoded, encoding::DecoderTrap::Replace) + .map_err(|e| e.into()) } /// Get the body of the message as a Rust Vec<u8>. This function tries to |