fetch_single_msg: use if let Some(...) instead of is_empty()

This commit is contained in:
Alexander Krotov
2020-02-16 04:10:35 +03:00
committed by holger krekel
parent 793ebe1b0f
commit 08c77c2668

View File

@@ -755,16 +755,7 @@ impl Imap {
return Err(Error::Other("Could not get IMAP session".to_string()));
};
if msgs.is_empty() {
warn!(
context,
"Message #{} does not exist in folder \"{}\".",
server_uid,
folder.as_ref()
);
} else {
let msg = &msgs[0];
if let Some(msg) = msgs.first() {
// XXX put flags into a set and pass them to dc_receive_imf
let is_deleted = msg.flags().any(|flag| match flag {
Flag::Deleted => true,
@@ -789,6 +780,13 @@ impl Imap {
);
}
}
} else {
warn!(
context,
"Message #{} does not exist in folder \"{}\".",
server_uid,
folder.as_ref()
);
}
Ok(())