Optimize: Do not compute lowercase key twice
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
ce678d6418
commit
ae95022202
1 changed files with 3 additions and 2 deletions
|
@ -42,8 +42,9 @@ pub(crate) fn get_message_header_at_key<P: AsRef<Path>, K: AsRef<str>>(p: P, k:
|
||||||
.filter_map(|hdr| match hdr.get_key() {
|
.filter_map(|hdr| match hdr.get_key() {
|
||||||
Err(e) => Some(Err(e).map_err(Error::from)),
|
Err(e) => Some(Err(e).map_err(Error::from)),
|
||||||
Ok(key) => {
|
Ok(key) => {
|
||||||
trace!("Test: {} == {}", key.to_lowercase(), k.as_ref());
|
let lower_key = key.to_lowercase();
|
||||||
if key.to_lowercase() == k.as_ref() {
|
trace!("Test: {} == {}", lower_key, k.as_ref());
|
||||||
|
if lower_key == k.as_ref() {
|
||||||
Some(Ok(hdr))
|
Some(Ok(hdr))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in a new issue