diff --git a/src/configure.rs b/src/configure.rs index 42922f145..e82a49ff8 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -131,7 +131,7 @@ async fn on_configure_completed( ) -> Result<()> { if let Some(provider) = param.provider { if let Some(config_defaults) = &provider.config_defaults { - for def in config_defaults.iter() { + for def in config_defaults { if !context.config_exists(def.key).await? { info!(context, "apply config_defaults {}={}", def.key, def.value); context.set_config(def.key, Some(def.value)).await?; @@ -318,7 +318,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> { } // respect certificate setting from function parameters - for mut server in &mut servers { + for server in &mut servers { let certificate_checks = match server.protocol { Protocol::Imap => param.imap.certificate_checks, Protocol::Smtp => param.smtp.certificate_checks, @@ -653,7 +653,7 @@ async fn try_smtp_one_param( }) } else { info!(context, "success: {}", inf); - smtp.disconnect().await; + smtp.disconnect(); Ok(()) } } diff --git a/src/configure/auto_mozilla.rs b/src/configure/auto_mozilla.rs index 505691814..617429f59 100644 --- a/src/configure/auto_mozilla.rs +++ b/src/configure/auto_mozilla.rs @@ -234,7 +234,7 @@ fn parse_serverparams(in_emailaddr: &str, xml_raw: &str) -> Result Some(Protocol::Imap), diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 5c5a64c17..54050a0e3 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -545,7 +545,7 @@ async fn next_expiration_timestamp(context: &Context) -> Option { ephemeral_timestamp .into_iter() - .chain(delete_device_after_timestamp.into_iter()) + .chain(delete_device_after_timestamp) .min() } diff --git a/src/html.rs b/src/html.rs index 306ce2ae1..7124c0a1a 100644 --- a/src/html.rs +++ b/src/html.rs @@ -291,7 +291,7 @@ mod tests { let parser = HtmlMsgParser::from_bytes(&t.ctx, raw).await.unwrap(); assert_eq!( parser.html, - r##" + r#" @@ -299,7 +299,7 @@ mod tests { This message does not have Content-Type nor Subject.

-"## +"# ); } @@ -310,7 +310,7 @@ This message does not have Content-Type nor Subject.
let parser = HtmlMsgParser::from_bytes(&t.ctx, raw).await.unwrap(); assert_eq!( parser.html, - r##" + r#" @@ -318,7 +318,7 @@ This message does not have Content-Type nor Subject.
message with a non-UTF-8 encoding: äöüßÄÖÜ

-"## +"# ); } @@ -330,7 +330,7 @@ message with a non-UTF-8 encoding: äöüßÄÖÜ
assert!(parser.plain.unwrap().flowed); assert_eq!( parser.html, - r##" + r#" @@ -341,7 +341,7 @@ This line does not end with a space
and will be wrapped as usual.

-"## +"# ); } @@ -352,7 +352,7 @@ and will be wrapped as usual.
let parser = HtmlMsgParser::from_bytes(&t.ctx, raw).await.unwrap(); assert_eq!( parser.html, - r##" + r#" @@ -363,7 +363,7 @@ test some special html-characters as < > and & but also " and &#x

-"## +"# ); } diff --git a/src/location.rs b/src/location.rs index 099ea3da9..7383dfc78 100644 --- a/src/location.rs +++ b/src/location.rs @@ -735,7 +735,7 @@ async fn maybe_send_locations(context: &Context) -> Result> { next_event = next_event .into_iter() - .chain(u64::try_from(locations_send_until - now).into_iter()) + .chain(u64::try_from(locations_send_until - now)) .min(); if has_locations { @@ -759,7 +759,7 @@ async fn maybe_send_locations(context: &Context) -> Result> { ); next_event = next_event .into_iter() - .chain(u64::try_from(locations_last_sent + 61 - now).into_iter()) + .chain(u64::try_from(locations_last_sent + 61 - now)) .min(); } } else { diff --git a/src/mimeparser.rs b/src/mimeparser.rs index a9a039685..a0cccd1b2 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -643,7 +643,7 @@ impl MimeMessage { .parts .iter_mut() .find(|part| !part.msg.is_empty() && !part.is_reaction); - if let Some(mut part) = part_with_text { + if let Some(part) = part_with_text { part.msg = format!("{} – {}", subject, part.msg); } } @@ -2062,7 +2062,8 @@ async fn handle_mdn( Ok((msg_id, chat_id, msg_state)) }, ) - .await? else { + .await? + else { info!( context, "Ignoring MDN, found no message with Message-ID {rfc724_mid:?} sent by us in the database.", @@ -3089,7 +3090,7 @@ CWt6wx7fiLp0qS9RrX75g6Gqw7nfCs6EcBERcIPt7DTe8VStJwf3LWqVwxl4gQl46yhfoqwEO+I= #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn parse_outlook_html_embedded_image() { let context = TestContext::new_alice().await; - let raw = br##"From: Anonymous + let raw = br#"From: Anonymous To: Anonymous Subject: Delta Chat is great stuff! Date: Tue, 5 May 2020 01:23:45 +0000 @@ -3144,7 +3145,7 @@ K+TuvC7qOah0WLFhcsXWn2+dDV1bXuAeC769TkqkpHhdXfUHnVgK3Pv7u3rVPT5AMeFUGxRB2dP4 CWt6wx7fiLp0qS9RrX75g6Gqw7nfCs6EcBERcIPt7DTe8VStJwf3LWqVwxl4gQl46yhfoqwEO+I= ------=_NextPart_000_0003_01D622B3.CA753E60-- -"##; +"#; let message = MimeMessage::from_bytes(&context.ctx, &raw[..], None) .await @@ -3519,7 +3520,7 @@ On 2020-10-25, Bob wrote: // A message with a long Message-ID. // Long message-IDs are generated by Mailjet. - let raw = br###"Date: Thu, 28 Jan 2021 00:26:57 +0000 + let raw = br"Date: Thu, 28 Jan 2021 00:26:57 +0000 Chat-Version: 1.0\n\ Message-ID: To: Bob @@ -3527,11 +3528,11 @@ From: Alice Subject: ... Some quote. -"###; +"; receive_imf(&t, raw, false).await?; // Delta Chat generates In-Reply-To with a starting tab when Message-ID is too long. - let raw = br###"In-Reply-To: + let raw = br"In-Reply-To: Date: Thu, 28 Jan 2021 00:26:57 +0000 Chat-Version: 1.0\n\ @@ -3543,7 +3544,7 @@ Subject: ... > Some quote. Some reply -"###; +"; receive_imf(&t, raw, false).await?; @@ -3561,7 +3562,7 @@ Some reply let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; - let raw = br###"Date: Thu, 28 Jan 2021 00:26:57 +0000 + let raw = br"Date: Thu, 28 Jan 2021 00:26:57 +0000 Chat-Version: 1.0\n\ Message-ID: To: Bob @@ -3570,7 +3571,7 @@ Subject: subject Chat-Disposition-Notification-To: alice@example.org Message. -"###; +"; // Bob receives message. receive_imf(&bob, raw, false).await?; diff --git a/src/plaintext.rs b/src/plaintext.rs index afd75b981..0c18fa104 100644 --- a/src/plaintext.rs +++ b/src/plaintext.rs @@ -26,10 +26,10 @@ impl PlainText { /// The function handles quotes, links, fixed and floating text paragraphs. pub fn to_html(&self) -> String { static LINKIFY_MAIL_RE: Lazy = - Lazy::new(|| regex::Regex::new(r#"\b([\w.\-+]+@[\w.\-]+)\b"#).unwrap()); + Lazy::new(|| regex::Regex::new(r"\b([\w.\-+]+@[\w.\-]+)\b").unwrap()); static LINKIFY_URL_RE: Lazy = Lazy::new(|| { - regex::Regex::new(r#"\b((http|https|ftp|ftps):[\w.,:;$/@!?&%\-~=#+]+)"#).unwrap() + regex::Regex::new(r"\b((http|https|ftp|ftps):[\w.,:;$/@!?&%\-~=#+]+)").unwrap() }); let lines = split_lines(&self.text); @@ -127,7 +127,7 @@ http://link-at-start-of-line.org .to_html(); assert_eq!( html, - r##" + r#" @@ -138,7 +138,7 @@ line with https://link-mid-of-line.orghttp://link-at-start-of-line.org

-"## +"# ); } diff --git a/src/provider.rs b/src/provider.rs index 58e1cd517..8035acd88 100644 --- a/src/provider.rs +++ b/src/provider.rs @@ -223,7 +223,7 @@ pub async fn get_provider_by_mx(context: &Context, domain: &str) -> Option<&'sta } if let Ok(mx_domains) = resolver.mx_lookup(fqdn).await { - for (provider_domain, provider) in PROVIDER_DATA.iter() { + for (provider_domain, provider) in &*PROVIDER_DATA { if provider.id != "gmail" { // MX lookup is limited to Gmail for security reasons continue; diff --git a/src/receive_imf.rs b/src/receive_imf.rs index c1d58a6d8..da2a89985 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -2347,7 +2347,7 @@ async fn add_or_lookup_contacts_by_address_list( origin: Origin, ) -> Result> { let mut contact_ids = HashSet::new(); - for info in address_list.iter() { + for info in address_list { let addr = &info.addr; if !may_be_valid_addr(addr) { continue; diff --git a/src/scheduler.rs b/src/scheduler.rs index 796222702..7ca697335 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -864,7 +864,7 @@ impl Scheduler { // Actually shutdown tasks. let timeout_duration = std::time::Duration::from_secs(30); - for b in once(self.inbox).chain(self.oboxes.into_iter()) { + for b in once(self.inbox).chain(self.oboxes) { tokio::time::timeout(timeout_duration, b.handle) .await .log_err(context) diff --git a/src/smtp.rs b/src/smtp.rs index 5cfc4fdfa..bea98ed48 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -55,7 +55,7 @@ impl Smtp { } /// Disconnect the SMTP transport and drop it entirely. - pub async fn disconnect(&mut self) { + pub fn disconnect(&mut self) { if let Some(mut transport) = self.transport.take() { // Closing connection with a QUIT command may take some time, especially if it's a // stale connection and an attempt to send the command times out. Send a command in a @@ -88,7 +88,7 @@ impl Smtp { pub async fn connect_configured(&mut self, context: &Context) -> Result<()> { if self.has_maybe_stale_connection() { info!(context, "Closing stale connection"); - self.disconnect().await; + self.disconnect(); } if self.is_connected() { @@ -465,13 +465,13 @@ pub(crate) async fn smtp_send( // this clears last_success info info!(context, "Failed to send message over SMTP, disconnecting"); - smtp.disconnect().await; + smtp.disconnect(); res } Err(crate::smtp::send::Error::Envelope(err)) => { // Local error, job is invalid, do not retry. - smtp.disconnect().await; + smtp.disconnect(); warn!(context, "SMTP job is invalid: {}", err); SendResult::Failure(err) } @@ -483,7 +483,7 @@ pub(crate) async fn smtp_send( } Err(crate::smtp::send::Error::Other(err)) => { // Local error, job is invalid, do not retry. - smtp.disconnect().await; + smtp.disconnect(); warn!(context, "unable to load job: {}", err); SendResult::Failure(err) }