refactor: remove some .unwrap() calls

This commit is contained in:
link2xt
2024-11-27 18:56:39 +00:00
committed by l
parent d1537095e4
commit 6be96d3eba
5 changed files with 21 additions and 28 deletions

View File

@@ -1667,10 +1667,11 @@ impl MimeMessage {
{
let mut to_list =
get_all_addresses_from_header(&report.headers, "x-failed-recipients");
let to = if to_list.len() == 1 {
Some(to_list.pop().unwrap())
let to = if to_list.len() != 1 {
// We do not know which recipient failed
None
} else {
None // We do not know which recipient failed
to_list.pop()
};
return Ok(Some(DeliveryReport {