From 4d620afdb89714a07890843b56803b014c006624 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sun, 12 Mar 2023 14:51:44 +0000 Subject: [PATCH] Enable clippy::explicit_into_iter_loop --- src/chat.rs | 2 +- src/contact.rs | 2 +- src/imex.rs | 2 +- src/lib.rs | 1 + src/message.rs | 4 ++-- src/receive_imf.rs | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 06b029dd81..edffef4bad 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -418,7 +418,7 @@ impl ChatId { ProtectionStatus::Protected => match chat.typ { Chattype::Single | Chattype::Group | Chattype::Broadcast => { let contact_ids = get_chat_contacts(context, self).await?; - for contact_id in contact_ids.into_iter() { + for contact_id in contact_ids { let contact = Contact::get_by_id(context, contact_id).await?; if contact.is_verified(context).await? != VerifiedStatus::BidirectVerified { bail!("{} is not verified.", contact.get_display_name()); diff --git a/src/contact.rs b/src/contact.rs index 2ae958603d..4b8c4c3abd 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -727,7 +727,7 @@ impl Contact { pub async fn add_address_book(context: &Context, addr_book: &str) -> Result { let mut modify_cnt = 0; - for (name, addr) in split_address_book(addr_book).into_iter() { + for (name, addr) in split_address_book(addr_book) { let (name, addr) = sanitize_name_and_addr(name, addr); let name = normalize_name(&name); match ContactAddress::new(&addr) { diff --git a/src/imex.rs b/src/imex.rs index d26a0a6131..bd70918002 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -602,7 +602,7 @@ async fn export_backup_inner( let mut written_files = 0; let mut last_progress = 0; - for entry in read_dir.into_iter() { + for entry in read_dir { let name = entry.file_name(); if !entry.file_type().await?.is_file() { warn!( diff --git a/src/lib.rs b/src/lib.rs index b15f5dcf71..51a72a1d57 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ clippy::cast_lossless, clippy::unused_async, clippy::explicit_iter_loop, + clippy::explicit_into_iter_loop, clippy::cloned_instead_of_copied )] #![allow( diff --git a/src/message.rs b/src/message.rs index fd88cf628d..258a8624aa 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1502,7 +1502,7 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec) -> Result<()> curr_rfc724_mid, curr_blocked, _curr_ephemeral_timer, - ) in msgs.into_iter() + ) in msgs { if curr_blocked == Blocked::Not && (curr_state == MessageState::InFresh || curr_state == MessageState::InNoticed) @@ -1741,7 +1741,7 @@ pub(crate) async fn handle_ndn( }; let mut first = true; - for msg in msgs.into_iter() { + for msg in msgs { let (msg_id, chat_id, chat_type) = msg?; set_msg_failed(context, msg_id, &error).await; if first { diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 9a8504d434..c37eb36333 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -2162,7 +2162,7 @@ async fn check_verified_properties( ) .await?; - for (to_addr, mut is_verified) in rows.into_iter() { + for (to_addr, mut is_verified) in rows { info!( context, "check_verified_properties: {:?} self={:?}",