From 66cf0883aa8514d77ad72f206bc5fe1e026e3c9e Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Fri, 7 Sep 2018 01:36:41 +0100 Subject: Tidy is_boundary() --- src/lib.rs | 8 +++----- 1 file 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) -> 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 { -- cgit v1.2.3