From ae95022202215a00c480d6664e951f0742b51d36 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 28 Feb 2019 18:07:25 +0100 Subject: [PATCH] Optimize: Do not compute lowercase key twice Signed-off-by: Matthias Beyer --- lib/domain/libimagmail/src/util.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/domain/libimagmail/src/util.rs b/lib/domain/libimagmail/src/util.rs index b1c2b5b9..c4c3c91f 100644 --- a/lib/domain/libimagmail/src/util.rs +++ b/lib/domain/libimagmail/src/util.rs @@ -42,8 +42,9 @@ pub(crate) fn get_message_header_at_key, K: AsRef>(p: P, k: .filter_map(|hdr| match hdr.get_key() { Err(e) => Some(Err(e).map_err(Error::from)), Ok(key) => { - trace!("Test: {} == {}", key.to_lowercase(), k.as_ref()); - if key.to_lowercase() == k.as_ref() { + let lower_key = key.to_lowercase(); + trace!("Test: {} == {}", lower_key, k.as_ref()); + if lower_key == k.as_ref() { Some(Ok(hdr)) } else { None