mirror of
https://github.com/chatmail/core.git
synced 2026-05-24 17:26:30 +03:00
Remove explicit .iter() and .iter_mut() calls in for loops
This commit is contained in:
@@ -124,7 +124,7 @@ impl HtmlMsgParser {
|
|||||||
async move {
|
async move {
|
||||||
match get_mime_multipart_type(&mail.ctype) {
|
match get_mime_multipart_type(&mail.ctype) {
|
||||||
MimeMultipartType::Multiple => {
|
MimeMultipartType::Multiple => {
|
||||||
for cur_data in mail.subparts.iter() {
|
for cur_data in &mail.subparts {
|
||||||
self.collect_texts_recursive(cur_data).await?
|
self.collect_texts_recursive(cur_data).await?
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -180,7 +180,7 @@ impl HtmlMsgParser {
|
|||||||
async move {
|
async move {
|
||||||
match get_mime_multipart_type(&mail.ctype) {
|
match get_mime_multipart_type(&mail.ctype) {
|
||||||
MimeMultipartType::Multiple => {
|
MimeMultipartType::Multiple => {
|
||||||
for cur_data in mail.subparts.iter() {
|
for cur_data in &mail.subparts {
|
||||||
self.cid_to_data_recursive(context, cur_data).await?;
|
self.cid_to_data_recursive(context, cur_data).await?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1390,7 +1390,7 @@ impl Imap {
|
|||||||
let mut uid_msgs = HashMap::with_capacity(request_uids.len());
|
let mut uid_msgs = HashMap::with_capacity(request_uids.len());
|
||||||
|
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for &request_uid in request_uids.iter() {
|
for &request_uid in &request_uids {
|
||||||
// Check if FETCH response is already in `uid_msgs`.
|
// Check if FETCH response is already in `uid_msgs`.
|
||||||
let mut fetch_response = uid_msgs.remove(&request_uid);
|
let mut fetch_response = uid_msgs.remove(&request_uid);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
clippy::wildcard_imports,
|
clippy::wildcard_imports,
|
||||||
clippy::needless_borrow,
|
clippy::needless_borrow,
|
||||||
clippy::cast_lossless,
|
clippy::cast_lossless,
|
||||||
clippy::unused_async
|
clippy::unused_async,
|
||||||
|
clippy::explicit_iter_loop
|
||||||
)]
|
)]
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::match_bool,
|
clippy::match_bool,
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ impl<'a> MimeFactory<'a> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
for (name, addr) in self.recipients.iter() {
|
for (name, addr) in &self.recipients {
|
||||||
if let Some(email_to_remove) = email_to_remove {
|
if let Some(email_to_remove) = email_to_remove {
|
||||||
if email_to_remove == addr {
|
if email_to_remove == addr {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ impl MimeMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.is_forwarded {
|
if self.is_forwarded {
|
||||||
for part in self.parts.iter_mut() {
|
for part in &mut self.parts {
|
||||||
part.param.set_int(Param::Forwarded, 1);
|
part.param.set_int(Param::Forwarded, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -943,7 +943,7 @@ impl MimeMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add all parts (we need another part, preferably text/plain, to show as an error message)
|
// Add all parts (we need another part, preferably text/plain, to show as an error message)
|
||||||
for cur_data in mail.subparts.iter() {
|
for cur_data in &mail.subparts {
|
||||||
if self
|
if self
|
||||||
.parse_mime_recursive(context, cur_data, is_related)
|
.parse_mime_recursive(context, cur_data, is_related)
|
||||||
.await?
|
.await?
|
||||||
@@ -977,7 +977,7 @@ impl MimeMessage {
|
|||||||
_ => {
|
_ => {
|
||||||
// Add all parts (in fact, AddSinglePartIfKnown() later check if
|
// Add all parts (in fact, AddSinglePartIfKnown() later check if
|
||||||
// the parts are really supported)
|
// the parts are really supported)
|
||||||
for cur_data in mail.subparts.iter() {
|
for cur_data in &mail.subparts {
|
||||||
if self
|
if self
|
||||||
.parse_mime_recursive(context, cur_data, is_related)
|
.parse_mime_recursive(context, cur_data, is_related)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ async fn lookup_host_with_cache(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for addr in resolved_addrs.iter() {
|
for addr in &resolved_addrs {
|
||||||
let ip_string = addr.ip().to_string();
|
let ip_string = addr.ip().to_string();
|
||||||
if ip_string == hostname {
|
if ip_string == hostname {
|
||||||
// IP address resolved into itself, not interesting to cache.
|
// IP address resolved into itself, not interesting to cache.
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ async fn add_parts(
|
|||||||
// to the sender's name, indicating to the user that he/she is not part of the group.
|
// to the sender's name, indicating to the user that he/she is not part of the group.
|
||||||
let from = &mime_parser.from;
|
let from = &mime_parser.from;
|
||||||
let name: &str = from.display_name.as_ref().unwrap_or(&from.addr);
|
let name: &str = from.display_name.as_ref().unwrap_or(&from.addr);
|
||||||
for part in mime_parser.parts.iter_mut() {
|
for part in &mut mime_parser.parts {
|
||||||
part.param.set(Param::OverrideSenderDisplayname, name);
|
part.param.set(Param::OverrideSenderDisplayname, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -668,7 +668,7 @@ async fn add_parts(
|
|||||||
// we use name from From:-header as override name
|
// we use name from From:-header as override name
|
||||||
if prevent_rename {
|
if prevent_rename {
|
||||||
if let Some(name) = &mime_parser.from.display_name {
|
if let Some(name) = &mime_parser.from.display_name {
|
||||||
for part in mime_parser.parts.iter_mut() {
|
for part in &mut mime_parser.parts {
|
||||||
part.param.set(Param::OverrideSenderDisplayname, name);
|
part.param.set(Param::OverrideSenderDisplayname, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user