mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
refactor: use HashMap::extract_if() stabilized in Rust 1.88.0
This commit is contained in:
@@ -273,12 +273,11 @@ impl MimeMessage {
|
|||||||
&mut chat_disposition_notification_to,
|
&mut chat_disposition_notification_to,
|
||||||
&mail,
|
&mail,
|
||||||
);
|
);
|
||||||
headers.retain(|k, _| {
|
headers_removed.extend(
|
||||||
!is_hidden(k) || {
|
headers
|
||||||
headers_removed.insert(k.to_string());
|
.extract_if(|k, _v| is_hidden(k))
|
||||||
false
|
.map(|(k, _v)| k.to_string()),
|
||||||
}
|
);
|
||||||
});
|
|
||||||
|
|
||||||
// Parse hidden headers.
|
// Parse hidden headers.
|
||||||
let mimetype = mail.ctype.mimetype.parse::<Mime>()?;
|
let mimetype = mail.ctype.mimetype.parse::<Mime>()?;
|
||||||
@@ -1680,12 +1679,11 @@ impl MimeMessage {
|
|||||||
// See <https://www.rfc-editor.org/rfc/rfc9788.html>.
|
// See <https://www.rfc-editor.org/rfc/rfc9788.html>.
|
||||||
let has_header_protection = part.ctype.params.contains_key("hp");
|
let has_header_protection = part.ctype.params.contains_key("hp");
|
||||||
|
|
||||||
headers.retain(|k, _| {
|
headers_removed.extend(
|
||||||
!(has_header_protection || is_protected(k)) || {
|
headers
|
||||||
headers_removed.insert(k.to_string());
|
.extract_if(|k, _v| has_header_protection || is_protected(k))
|
||||||
false
|
.map(|(k, _v)| k.to_string()),
|
||||||
}
|
);
|
||||||
});
|
|
||||||
for field in fields {
|
for field in fields {
|
||||||
// lowercasing all headers is technically not correct, but makes things work better
|
// lowercasing all headers is technically not correct, but makes things work better
|
||||||
let key = field.get_key().to_lowercase();
|
let key = field.get_key().to_lowercase();
|
||||||
|
|||||||
Reference in New Issue
Block a user