summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hurst <tom@hur.st>2018-09-07 01:36:41 +0100
committerKartikaya Gupta (kats) <staktrace@users.noreply.github.com>2018-09-07 11:51:51 -0400
commit66cf0883aa8514d77ad72f206bc5fe1e026e3c9e (patch)
treea793e49ce3501e5ae46766559abe927e6b9922ef
parent004ce278107014fbd465c85676e1bfe58b9e5dd1 (diff)
downloadmailparse-66cf0883aa8514d77ad72f206bc5fe1e026e3c9e.tar.gz
mailparse-66cf0883aa8514d77ad72f206bc5fe1e026e3c9e.tar.xz
Tidy is_boundary()
-rw-r--r--src/lib.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8c47090..8c56322 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,11 +95,9 @@ pub struct MailHeader<'a> {
}
fn is_boundary(line: &str, ix: Option<usize>) -> bool {
- ix.map(|v| {
- line.chars().nth(v).map_or(true, |c| {
- c.is_whitespace() || c == '"' || c == '(' || c == ')' || c == '<' || c == '>'
- })
- }).unwrap_or(true)
+ ix.and_then(|v| line.chars().nth(v))
+ .map(|c| c.is_whitespace() || c == '"' || c == '(' || c == ')' || c == '<' || c == '>')
+ .unwrap_or(true)
}
fn find_from(line: &str, ix_start: usize, key: &str) -> Option<usize> {