diff options
author | Thomas Hurst <tom@hur.st> | 2018-09-07 01:36:41 +0100 |
---|---|---|
committer | Kartikaya Gupta (kats) <staktrace@users.noreply.github.com> | 2018-09-07 11:51:51 -0400 |
commit | 66cf0883aa8514d77ad72f206bc5fe1e026e3c9e (patch) | |
tree | a793e49ce3501e5ae46766559abe927e6b9922ef /src | |
parent | 004ce278107014fbd465c85676e1bfe58b9e5dd1 (diff) |
Tidy is_boundary()
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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> { |