Commit
Author: Mauro D [mauro@stalw.art]
Hash: a5a91a1e8ca6f11fc728430d9465dc756b148ad3
Timestamp: Fri, 27 Jan 2023 14:45:35 +0000 (1 year ago)

+97 -110 +/-18 browse
v0.3.0
1diff --git a/examples/report_arf_generate.rs b/examples/report_arf_generate.rs
2index 766680c..0633fe5 100644
3--- a/examples/report_arf_generate.rs
4+++ b/examples/report_arf_generate.rs
5 @@ -47,5 +47,5 @@ fn main() {
6 .unwrap();
7
8 // Print ARF feedback to stdout
9- println!("{}", feedback);
10+ println!("{feedback}");
11 }
12 diff --git a/examples/report_dmarc_generate.rs b/examples/report_dmarc_generate.rs
13index eb279d8..c089cab 100644
14--- a/examples/report_dmarc_generate.rs
15+++ b/examples/report_dmarc_generate.rs
16 @@ -105,5 +105,5 @@ fn main() {
17 .unwrap();
18
19 // Print report to stdout
20- println!("{}", report);
21+ println!("{report}");
22 }
23 diff --git a/src/arc/seal.rs b/src/arc/seal.rs
24index bc44bbe..464bc9c 100644
25--- a/src/arc/seal.rs
26+++ b/src/arc/seal.rs
27 @@ -326,7 +326,7 @@ mod test {
28 .selector(s)
29 .headers(["From", "To", "Subject", "DKIM-Signature"])
30 .seal(&message, &auth_results, &arc_result)
31- .unwrap_or_else(|err| panic!("Got {:?} for {}", err, raw_message));
32+ .unwrap_or_else(|err| panic!("Got {err:?} for {raw_message}"));
33 format!(
34 "{}{}{}",
35 arc.to_header(),
36 diff --git a/src/arc/verify.rs b/src/arc/verify.rs
37index 7ee20c6..f2feaeb 100644
38--- a/src/arc/verify.rs
39+++ b/src/arc/verify.rs
40 @@ -223,7 +223,7 @@ mod test {
41 {
42 #[cfg(any(test, feature = "test"))]
43 resolver.txt_add(
44- format!("{}.", key),
45+ format!("{key}."),
46 DomainKey::parse(value).unwrap(),
47 Instant::now() + Duration::new(3200, 0),
48 );
49 diff --git a/src/common/auth_results.rs b/src/common/auth_results.rs
50index 7f740c4..cb79d54 100644
51--- a/src/common/auth_results.rs
52+++ b/src/common/auth_results.rs
53 @@ -70,7 +70,7 @@ impl<'x> AuthenticationResults<'x> {
54 }
55
56 if dkim.is_atps {
57- write!(self.auth_results, " header.from={}", header_from).ok();
58+ write!(self.auth_results, " header.from={header_from}").ok();
59 }
60 }
61
62 @@ -84,10 +84,10 @@ impl<'x> AuthenticationResults<'x> {
63 spf.result.as_spf_result(
64 &mut self.auth_results,
65 self.hostname,
66- &format!("postmaster@{}", ehlo_domain),
67+ &format!("postmaster@{ehlo_domain}"),
68 ip_addr,
69 );
70- write!(self.auth_results, " smtp.helo={}", ehlo_domain).ok();
71+ write!(self.auth_results, " smtp.helo={ehlo_domain}").ok();
72 self
73 }
74
75 @@ -101,7 +101,7 @@ impl<'x> AuthenticationResults<'x> {
76 let (mail_from, addr) = if !from.is_empty() {
77 (Cow::from(from), from)
78 } else {
79- (format!("postmaster@{}", ehlo_domain).into(), "<>")
80+ (format!("postmaster@{ehlo_domain}").into(), "<>")
81 };
82 self.auth_results.push_str(";\r\n\tspf=");
83 spf.result.as_spf_result(
84 @@ -110,14 +110,14 @@ impl<'x> AuthenticationResults<'x> {
85 mail_from.as_ref(),
86 ip_addr,
87 );
88- write!(self.auth_results, " smtp.mailfrom={}", addr).ok();
89+ write!(self.auth_results, " smtp.mailfrom={addr}").ok();
90 self
91 }
92
93 pub fn with_arc_result(mut self, arc: &ArcOutput, remote_ip: IpAddr) -> Self {
94 self.auth_results.push_str(";\r\n\tarc=");
95 arc.result.as_auth_result(&mut self.auth_results);
96- write!(self.auth_results, " smtp.remote-ip={}", remote_ip).ok();
97+ write!(self.auth_results, " smtp.remote-ip={remote_ip}").ok();
98 self
99 }
100
101 @@ -144,7 +144,7 @@ impl<'x> AuthenticationResults<'x> {
102 pub fn with_iprev_result(mut self, iprev: &IprevOutput, remote_ip: IpAddr) -> Self {
103 self.auth_results.push_str(";\r\n\tiprev=");
104 iprev.result.as_auth_result(&mut self.auth_results);
105- write!(self.auth_results, " policy.iprev={}", remote_ip).ok();
106+ write!(self.auth_results, " policy.iprev={remote_ip}").ok();
107 self
108 }
109 }
110 @@ -189,7 +189,7 @@ impl ReceivedSpf {
111 let mail_from = if !mail_from.is_empty() {
112 Cow::from(mail_from)
113 } else {
114- format!("postmaster@{}", helo).into()
115+ format!("postmaster@{helo}").into()
116 };
117
118 spf.result
119 @@ -197,8 +197,7 @@ impl ReceivedSpf {
120
121 write!(
122 received_spf,
123- "\r\n\treceiver={}; client-ip={}; envelope-from=\"{}\"; helo={};",
124- hostname, ip_addr, mail_from, helo
125+ "\r\n\treceiver={hostname}; client-ip={ip_addr}; envelope-from=\"{mail_from}\"; helo={helo};",
126 )
127 .ok();
128
129 @@ -211,38 +210,31 @@ impl SpfResult {
130 match &self {
131 SpfResult::Pass => write!(
132 header,
133- "pass ({}: domain of {} designates {} as permitted sender)",
134- hostname, mail_from, ip_addr
135+ "pass ({hostname}: domain of {mail_from} designates {ip_addr} as permitted sender)",
136 ),
137 SpfResult::Fail => write!(
138 header,
139- "fail ({}: domain of {} does not designate {} as permitted sender)",
140- hostname, mail_from, ip_addr
141+ "fail ({hostname}: domain of {mail_from} does not designate {ip_addr} as permitted sender)",
142 ),
143 SpfResult::SoftFail => write!(
144 header,
145- "softfail ({}: domain of {} reports soft fail for {})",
146- hostname, mail_from, ip_addr
147+ "softfail ({hostname}: domain of {mail_from} reports soft fail for {ip_addr})",
148 ),
149 SpfResult::Neutral => write!(
150 header,
151- "neutral ({}: domain of {} reports neutral for {})",
152- hostname, mail_from, ip_addr
153+ "neutral ({hostname}: domain of {mail_from} reports neutral for {ip_addr})",
154 ),
155 SpfResult::TempError => write!(
156 header,
157- "temperror ({}: temporary dns error validating {})",
158- hostname, mail_from
159+ "temperror ({hostname}: temporary dns error validating {mail_from})",
160 ),
161 SpfResult::PermError => write!(
162 header,
163- "permerror ({}: unable to verify SPF record for {})",
164- hostname, mail_from,
165+ "permerror ({hostname}: unable to verify SPF record for {mail_from})",
166 ),
167 SpfResult::None => write!(
168 header,
169- "none ({}: no SPF records found for {})",
170- hostname, mail_from
171+ "none ({hostname}: no SPF records found for {mail_from})",
172 ),
173 }
174 .ok();
175 @@ -343,7 +335,7 @@ impl AsAuthResult for Error {
176 Error::DnsError(_) => "dns error",
177 Error::DnsRecordNotFound(_) => "dns record not found",
178 Error::ArcInvalidInstance(i) => {
179- write!(header, "invalid ARC instance {})", i).ok();
180+ write!(header, "invalid ARC instance {i})").ok();
181 return;
182 }
183 Error::ArcInvalidCV => "invalid ARC cv",
184 diff --git a/src/dkim/headers.rs b/src/dkim/headers.rs
185index 6f70bd0..aba5e91 100644
186--- a/src/dkim/headers.rs
187+++ b/src/dkim/headers.rs
188 @@ -80,7 +80,7 @@ impl Signature {
189 for &ch in self.i.as_bytes().iter() {
190 match ch {
191 0..=0x20 | b';' | 0x7f..=u8::MAX => {
192- writer.write_len(format!("={:02X}", ch).as_bytes(), &mut bw);
193+ writer.write_len(format!("={ch:02X}").as_bytes(), &mut bw);
194 }
195 _ => {
196 writer.write_len(&[ch], &mut bw);
197 diff --git a/src/dkim/parse.rs b/src/dkim/parse.rs
198index 077e461..2d5d096 100644
199--- a/src/dkim/parse.rs
200+++ b/src/dkim/parse.rs
201 @@ -605,20 +605,20 @@ mod test {
202 ),
203 ] {
204 let result = Signature::parse(signature.as_bytes()).unwrap();
205- assert_eq!(result.v, expected_result.v, "{:?}", signature);
206- assert_eq!(result.a, expected_result.a, "{:?}", signature);
207- assert_eq!(result.d, expected_result.d, "{:?}", signature);
208- assert_eq!(result.s, expected_result.s, "{:?}", signature);
209- assert_eq!(result.i, expected_result.i, "{:?}", signature);
210- assert_eq!(result.b, expected_result.b, "{:?}", signature);
211- assert_eq!(result.bh, expected_result.bh, "{:?}", signature);
212- assert_eq!(result.h, expected_result.h, "{:?}", signature);
213- assert_eq!(result.z, expected_result.z, "{:?}", signature);
214- assert_eq!(result.l, expected_result.l, "{:?}", signature);
215- assert_eq!(result.x, expected_result.x, "{:?}", signature);
216- assert_eq!(result.t, expected_result.t, "{:?}", signature);
217- assert_eq!(result.ch, expected_result.ch, "{:?}", signature);
218- assert_eq!(result.cb, expected_result.cb, "{:?}", signature);
219+ assert_eq!(result.v, expected_result.v, "{signature:?}");
220+ assert_eq!(result.a, expected_result.a, "{signature:?}");
221+ assert_eq!(result.d, expected_result.d, "{signature:?}");
222+ assert_eq!(result.s, expected_result.s, "{signature:?}");
223+ assert_eq!(result.i, expected_result.i, "{signature:?}");
224+ assert_eq!(result.b, expected_result.b, "{signature:?}");
225+ assert_eq!(result.bh, expected_result.bh, "{signature:?}");
226+ assert_eq!(result.h, expected_result.h, "{signature:?}");
227+ assert_eq!(result.z, expected_result.z, "{signature:?}");
228+ assert_eq!(result.l, expected_result.l, "{signature:?}");
229+ assert_eq!(result.x, expected_result.x, "{signature:?}");
230+ assert_eq!(result.t, expected_result.t, "{signature:?}");
231+ assert_eq!(result.ch, expected_result.ch, "{signature:?}");
232+ assert_eq!(result.cb, expected_result.cb, "{signature:?}");
233 }
234 }
235
236 diff --git a/src/dkim/sign.rs b/src/dkim/sign.rs
237index ea3dd24..a39aa84 100644
238--- a/src/dkim/sign.rs
239+++ b/src/dkim/sign.rs
240 @@ -461,7 +461,7 @@ mod test {
241 DkimResult::Fail(hdr) | DkimResult::PermError(hdr) | DkimResult::Neutral(hdr),
242 Err(err),
243 ) if hdr == err => (),
244- (result, expect) => panic!("Expected {:?} but got {:?}.", expect, result),
245+ (result, expect) => panic!("Expected {expect:?} but got {result:?}."),
246 }
247
248 dkim.into_iter()
249 diff --git a/src/dkim/verify.rs b/src/dkim/verify.rs
250index 381160b..a590339 100644
251--- a/src/dkim/verify.rs
252+++ b/src/dkim/verify.rs
253 @@ -415,7 +415,7 @@ mod test {
254 {
255 #[cfg(any(test, feature = "test"))]
256 resolver.txt_add(
257- format!("{}.", key),
258+ format!("{key}."),
259 DomainKey::parse(value).unwrap(),
260 Instant::now() + Duration::new(3200, 0),
261 );
262 diff --git a/src/dmarc/parse.rs b/src/dmarc/parse.rs
263index d5e4506..eab5282 100644
264--- a/src/dmarc/parse.rs
265+++ b/src/dmarc/parse.rs
266 @@ -491,10 +491,9 @@ mod test {
267 ] {
268 assert_eq!(
269 Dmarc::parse(record.as_bytes())
270- .unwrap_or_else(|err| panic!("{:?} : {:?}", record, err)),
271+ .unwrap_or_else(|err| panic!("{record:?} : {err:?}")),
272 expected_result,
273- "{}",
274- record
275+ "{record}"
276 );
277 }
278 }
279 diff --git a/src/dmarc/verify.rs b/src/dmarc/verify.rs
280index bdb9544..630947c 100644
281--- a/src/dmarc/verify.rs
282+++ b/src/dmarc/verify.rs
283 @@ -67,13 +67,13 @@ impl Resolver {
284 let has_dkim_pass = dkim_output.iter().any(|o| o.result == DkimResult::Pass);
285 if spf_output.result == SpfResult::Pass || has_dkim_pass {
286 // Check SPF alignment
287- let from_subdomain = format!(".{}", from_domain);
288+ let from_subdomain = format!(".{from_domain}");
289 if spf_output.result == SpfResult::Pass {
290 output.spf_result = if mail_from_domain == from_domain {
291 DmarcResult::Pass
292 } else if dmarc.aspf == Alignment::Relaxed
293 && mail_from_domain.ends_with(&from_subdomain)
294- || from_domain.ends_with(&format!(".{}", mail_from_domain))
295+ || from_domain.ends_with(&format!(".{mail_from_domain}"))
296 {
297 output.policy = dmarc.sp;
298 DmarcResult::Pass
299 diff --git a/src/lib.rs b/src/lib.rs
300index cc5bf7f..60886dc 100644
301--- a/src/lib.rs
302+++ b/src/lib.rs
303 @@ -476,8 +476,8 @@ impl Display for Error {
304 Error::ParseError => write!(f, "Parse error"),
305 Error::MissingParameters => write!(f, "Missing parameters"),
306 Error::NoHeadersFound => write!(f, "No headers found"),
307- Error::CryptoError(err) => write!(f, "Cryptography layer error: {}", err),
308- Error::Io(e) => write!(f, "I/O error: {}", e),
309+ Error::CryptoError(err) => write!(f, "Cryptography layer error: {err}"),
310+ Error::Io(e) => write!(f, "I/O error: {e}"),
311 Error::Base64 => write!(f, "Base64 encode or decode error."),
312 Error::UnsupportedVersion => write!(f, "Unsupported version in DKIM Signature"),
313 Error::UnsupportedAlgorithm => write!(f, "Unsupported algorithm in DKIM Signature"),
314 @@ -499,15 +499,15 @@ impl Display for Error {
315 Error::SignatureExpired => write!(f, "Signature expired"),
316 Error::FailedAuidMatch => write!(f, "AUID does not match domain name"),
317 Error::ArcInvalidInstance(i) => {
318- write!(f, "Invalid 'i={}' value found in ARC header", i)
319+ write!(f, "Invalid 'i={i}' value found in ARC header")
320 }
321 Error::ArcInvalidCV => write!(f, "Invalid 'cv=' value found in ARC header"),
322 Error::ArcHasHeaderTag => write!(f, "Invalid 'h=' tag present in ARC-Seal"),
323 Error::ArcBrokenChain => write!(f, "Broken or missing ARC chain"),
324 Error::ArcChainTooLong => write!(f, "Too many ARC headers"),
325 Error::InvalidRecordType => write!(f, "Invalid record"),
326- Error::DnsError(err) => write!(f, "DNS resolution error: {}", err),
327- Error::DnsRecordNotFound(code) => write!(f, "DNS record not found: {}", code),
328+ Error::DnsError(err) => write!(f, "DNS resolution error: {err}"),
329+ Error::DnsRecordNotFound(code) => write!(f, "DNS record not found: {code}"),
330 Error::NotAligned => write!(f, "Policy not aligned"),
331 }
332 }
333 @@ -531,9 +531,9 @@ impl Display for IprevResult {
334 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
335 match self {
336 IprevResult::Pass => f.write_str("pass"),
337- IprevResult::Fail(err) => write!(f, "fail; {}", err),
338- IprevResult::TempError(err) => write!(f, "temp error; {}", err),
339- IprevResult::PermError(err) => write!(f, "perm error; {}", err),
340+ IprevResult::Fail(err) => write!(f, "fail; {err}"),
341+ IprevResult::TempError(err) => write!(f, "temp error; {err}"),
342+ IprevResult::PermError(err) => write!(f, "perm error; {err}"),
343 IprevResult::None => f.write_str("none"),
344 }
345 }
346 @@ -543,10 +543,10 @@ impl Display for DkimResult {
347 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
348 match self {
349 DkimResult::Pass => f.write_str("pass"),
350- DkimResult::Fail(err) => write!(f, "fail; {}", err),
351- DkimResult::Neutral(err) => write!(f, "neutral; {}", err),
352- DkimResult::TempError(err) => write!(f, "temp error; {}", err),
353- DkimResult::PermError(err) => write!(f, "perm error; {}", err),
354+ DkimResult::Fail(err) => write!(f, "fail; {err}"),
355+ DkimResult::Neutral(err) => write!(f, "neutral; {err}"),
356+ DkimResult::TempError(err) => write!(f, "temp error; {err}"),
357+ DkimResult::PermError(err) => write!(f, "perm error; {err}"),
358 DkimResult::None => f.write_str("none"),
359 }
360 }
361 @@ -556,9 +556,9 @@ impl Display for DmarcResult {
362 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
363 match self {
364 DmarcResult::Pass => f.write_str("pass"),
365- DmarcResult::Fail(err) => write!(f, "fail; {}", err),
366- DmarcResult::TempError(err) => write!(f, "temp error; {}", err),
367- DmarcResult::PermError(err) => write!(f, "perm error; {}", err),
368+ DmarcResult::Fail(err) => write!(f, "fail; {err}"),
369+ DmarcResult::TempError(err) => write!(f, "temp error; {err}"),
370+ DmarcResult::PermError(err) => write!(f, "perm error; {err}"),
371 DmarcResult::None => f.write_str("none"),
372 }
373 }
374 diff --git a/src/report/arf/generate.rs b/src/report/arf/generate.rs
375index ff3860c..c2c77c0 100644
376--- a/src/report/arf/generate.rs
377+++ b/src/report/arf/generate.rs
378 @@ -45,7 +45,7 @@ impl<'x> Feedback<'x> {
379 }
380 .ok();
381 if let Some(ip) = &self.source_ip {
382- write!(&mut text_body, "from IP address {} ", ip).ok();
383+ write!(&mut text_body, "from IP address {ip} ").ok();
384 }
385 let dt = DateTime::from_timestamp(if let Some(ad) = &self.arrival_date {
386 *ad
387 @@ -172,28 +172,28 @@ impl<'x> Feedback<'x> {
388 .ok();
389 }
390 if let Some(value) = &self.dkim_adsp_dns {
391- write!(&mut arf, "DKIM-ADSP-DNS: {}\r\n", value).ok();
392+ write!(&mut arf, "DKIM-ADSP-DNS: {value}\r\n").ok();
393 }
394 if let Some(value) = &self.dkim_canonicalized_body {
395- write!(&mut arf, "DKIM-Canonicalized-Body: {}\r\n", value).ok();
396+ write!(&mut arf, "DKIM-Canonicalized-Body: {value}\r\n").ok();
397 }
398 if let Some(value) = &self.dkim_canonicalized_header {
399- write!(&mut arf, "DKIM-Canonicalized-Header: {}\r\n", value).ok();
400+ write!(&mut arf, "DKIM-Canonicalized-Header: {value}\r\n").ok();
401 }
402 if let Some(value) = &self.dkim_domain {
403- write!(&mut arf, "DKIM-Domain: {}\r\n", value).ok();
404+ write!(&mut arf, "DKIM-Domain: {value}\r\n").ok();
405 }
406 if let Some(value) = &self.dkim_identity {
407- write!(&mut arf, "DKIM-Identity: {}\r\n", value).ok();
408+ write!(&mut arf, "DKIM-Identity: {value}\r\n").ok();
409 }
410 if let Some(value) = &self.dkim_selector {
411- write!(&mut arf, "DKIM-Selector: {}\r\n", value).ok();
412+ write!(&mut arf, "DKIM-Selector: {value}\r\n").ok();
413 }
414 if let Some(value) = &self.dkim_selector_dns {
415- write!(&mut arf, "DKIM-Selector-DNS: {}\r\n", value).ok();
416+ write!(&mut arf, "DKIM-Selector-DNS: {value}\r\n").ok();
417 }
418 if let Some(value) = &self.spf_dns {
419- write!(&mut arf, "SPF-DNS: {}\r\n", value).ok();
420+ write!(&mut arf, "SPF-DNS: {value}\r\n").ok();
421 }
422 if self.identity_alignment != IdentityAlignment::Unspecified {
423 write!(
424 @@ -212,37 +212,37 @@ impl<'x> Feedback<'x> {
425 }
426
427 for value in &self.authentication_results {
428- write!(&mut arf, "Authentication-Results: {}\r\n", value).ok();
429+ write!(&mut arf, "Authentication-Results: {value}\r\n").ok();
430 }
431 if self.incidents > 1 {
432 write!(&mut arf, "Incidents: {}\r\n", self.incidents).ok();
433 }
434 if let Some(value) = &self.original_envelope_id {
435- write!(&mut arf, "Original-Envelope-Id: {}\r\n", value).ok();
436+ write!(&mut arf, "Original-Envelope-Id: {value}\r\n").ok();
437 }
438 if let Some(value) = &self.original_mail_from {
439- write!(&mut arf, "Original-Mail-From: {}\r\n", value).ok();
440+ write!(&mut arf, "Original-Mail-From: {value}\r\n").ok();
441 }
442 if let Some(value) = &self.original_rcpt_to {
443- write!(&mut arf, "Original-Rcpt-To: {}\r\n", value).ok();
444+ write!(&mut arf, "Original-Rcpt-To: {value}\r\n").ok();
445 }
446 for value in &self.reported_domain {
447- write!(&mut arf, "Reported-Domain: {}\r\n", value).ok();
448+ write!(&mut arf, "Reported-Domain: {value}\r\n").ok();
449 }
450 for value in &self.reported_uri {
451- write!(&mut arf, "Reported-URI: {}\r\n", value).ok();
452+ write!(&mut arf, "Reported-URI: {value}\r\n").ok();
453 }
454 if let Some(value) = &self.reporting_mta {
455- write!(&mut arf, "Reporting-MTA: dns;{}\r\n", value).ok();
456+ write!(&mut arf, "Reporting-MTA: dns;{value}\r\n").ok();
457 }
458 if let Some(value) = &self.source_ip {
459- write!(&mut arf, "Source-IP: {}\r\n", value).ok();
460+ write!(&mut arf, "Source-IP: {value}\r\n").ok();
461 }
462 if self.source_port != 0 {
463 write!(&mut arf, "Source-Port: {}\r\n", self.source_port).ok();
464 }
465 if let Some(value) = &self.user_agent {
466- write!(&mut arf, "User-Agent: {}\r\n", value).ok();
467+ write!(&mut arf, "User-Agent: {value}\r\n").ok();
468 }
469
470 arf
471 diff --git a/src/report/dmarc/generate.rs b/src/report/dmarc/generate.rs
472index 34c93eb..f0d6235 100644
473--- a/src/report/dmarc/generate.rs
474+++ b/src/report/dmarc/generate.rs
475 @@ -146,7 +146,7 @@ impl PolicyPublished {
476 writeln!(xml, "\t<policy_published>").ok();
477 writeln!(xml, "\t\t<domain>{}</domain>", escape_xml(&self.domain)).ok();
478 if let Some(vp) = &self.version_published {
479- writeln!(xml, "\t\t<version_published>{}</version_published>", vp).ok();
480+ writeln!(xml, "\t\t<version_published>{vp}</version_published>").ok();
481 }
482 writeln!(xml, "\t\t<adkim>{}</adkim>", &self.adkim).ok();
483 writeln!(xml, "\t\t<aspf>{}</aspf>", &self.aspf).ok();
484 @@ -185,7 +185,7 @@ impl Row {
485 pub(crate) fn to_xml(&self, xml: &mut String) {
486 writeln!(xml, "\t\t<row>").ok();
487 if let Some(source_ip) = &self.source_ip {
488- writeln!(xml, "\t\t\t<source_ip>{}</source_ip>", source_ip).ok();
489+ writeln!(xml, "\t\t\t<source_ip>{source_ip}</source_ip>").ok();
490 }
491 writeln!(xml, "\t\t\t<count>{}</count>", self.count).ok();
492 self.policy_evaluated.to_xml(xml);
493 diff --git a/src/report/tlsrpt/generate.rs b/src/report/tlsrpt/generate.rs
494index f1518d4..020fd4e 100644
495--- a/src/report/tlsrpt/generate.rs
496+++ b/src/report/tlsrpt/generate.rs
497 @@ -138,7 +138,7 @@ mod test {
498 )
499 .unwrap();
500
501- println!("{}", message);
502+ //println!("{message}");
503
504 let parsed_report = TlsReport::parse_rfc5322(message.as_bytes()).unwrap();
505
506 diff --git a/src/spf/macros.rs b/src/spf/macros.rs
507index f8b664b..f01c7b1 100644
508--- a/src/spf/macros.rs
509+++ b/src/spf/macros.rs
510 @@ -101,7 +101,7 @@ impl<'x> Variables<'x> {
511 IpAddr::V6(ip) => {
512 let mut segments = Vec::with_capacity(63);
513 for segment in ip.segments() {
514- for &p in format!("{:04x}", segment).as_bytes() {
515+ for &p in format!("{segment:04x}").as_bytes() {
516 if !segments.is_empty() {
517 segments.push(b'.');
518 }
519 @@ -216,7 +216,7 @@ fn add_part(result: &mut Vec<u8>, part: &[u8], pos: usize, escape: bool) {
520 if ch.is_ascii_alphanumeric() || [b'-', b'.', b'_', b'~'].contains(ch) {
521 result.push(*ch);
522 } else {
523- result.extend_from_slice(format!("%{:02x}", ch).as_bytes());
524+ result.extend_from_slice(format!("%{ch:02x}").as_bytes());
525 }
526 }
527 }
528 @@ -273,7 +273,7 @@ mod test {
529 ),
530 ] {
531 let (m, _) = macro_string.as_bytes().iter().macro_string(false).unwrap();
532- assert_eq!(m.eval(&vars, "", false), expansion, "{:?}", macro_string);
533+ assert_eq!(m.eval(&vars, "", false), expansion, "{macro_string:?}");
534 }
535
536 let mut vars = Variables::new();
537 @@ -304,7 +304,7 @@ mod test {
538 ),
539 ] {
540 let (m, _) = macro_string.as_bytes().iter().macro_string(true).unwrap();
541- assert_eq!(m.eval(&vars, "", false), expansion, "{:?}", macro_string);
542+ assert_eq!(m.eval(&vars, "", false), expansion, "{macro_string:?}");
543 }
544 }
545 }
546 diff --git a/src/spf/parse.rs b/src/spf/parse.rs
547index ded6581..c1f82bf 100644
548--- a/src/spf/parse.rs
549+++ b/src/spf/parse.rs
550 @@ -1449,11 +1449,9 @@ mod test {
551 ),
552 ] {
553 assert_eq!(
554- Spf::parse(record.as_bytes())
555- .unwrap_or_else(|err| panic!("{:?} : {:?}", record, err)),
556+ Spf::parse(record.as_bytes()).unwrap_or_else(|err| panic!("{record:?} : {err:?}")),
557 expected_result,
558- "{}",
559- record
560+ "{record}"
561 );
562 }
563 }
564 @@ -1481,13 +1479,13 @@ mod test {
565 "::13.1.68.3",
566 "::FFFF:129.144.52.38",
567 ] {
568- for test in [test.to_string(), format!("{} ", test)] {
569+ for test in [test.to_string(), format!("{test} ")] {
570 let (ip, stop_char) = test
571 .as_bytes()
572 .iter()
573 .ip6()
574- .unwrap_or_else(|err| panic!("{:?} : {:?}", test, err));
575- assert_eq!(stop_char, b' ', "{}", test);
576+ .unwrap_or_else(|err| panic!("{test:?} : {err:?}"));
577+ assert_eq!(stop_char, b' ', "{test}");
578 assert_eq!(ip, test.trim_end().parse::<Ipv6Addr>().unwrap())
579 }
580 }
581 @@ -1511,13 +1509,13 @@ mod test {
582 #[test]
583 fn parse_ip4() {
584 for test in ["0.0.0.0", "255.255.255.255", "13.1.68.3", "129.144.52.38"] {
585- for test in [test.to_string(), format!("{} ", test)] {
586+ for test in [test.to_string(), format!("{test} ")] {
587 let (ip, stop_char) = test
588 .as_bytes()
589 .iter()
590 .ip4()
591- .unwrap_or_else(|err| panic!("{:?} : {:?}", test, err));
592- assert_eq!(stop_char, b' ', "{}", test);
593+ .unwrap_or_else(|err| panic!("{test:?} : {err:?}"));
594+ assert_eq!(stop_char, b' ', "{test}");
595 assert_eq!(ip, test.trim_end().parse::<Ipv4Addr>().unwrap());
596 }
597 }
598 diff --git a/src/spf/verify.rs b/src/spf/verify.rs
599index 24a338c..a2f3ba8 100644
600--- a/src/spf/verify.rs
601+++ b/src/spf/verify.rs
602 @@ -31,7 +31,7 @@ impl Resolver {
603 helo_domain,
604 helo_domain,
605 host_domain,
606- &format!("postmaster@{}", helo_domain),
607+ &format!("postmaster@{helo_domain}"),
608 )
609 .await
610 } else {
611 @@ -95,7 +95,7 @@ impl Resolver {
612 if !sender.is_empty() {
613 vars.set_sender(sender.as_bytes());
614 } else {
615- vars.set_sender(format!("postmaster@{}", domain).into_bytes());
616+ vars.set_sender(format!("postmaster@{domain}").into_bytes());
617 }
618 vars.set_domain(domain.as_bytes());
619 vars.set_host_domain(host_domain.as_bytes());
620 @@ -257,7 +257,7 @@ impl Resolver {
621 }
622
623 let target_addr = macro_string.eval(&vars, &domain, true).to_lowercase();
624- let target_sub_addr = format!(".{}", target_addr);
625+ let target_sub_addr = format!(".{target_addr}");
626 let mut matches = false;
627
628 if let Ok(records) = self.ptr_lookup(ip).await {
629 @@ -490,7 +490,7 @@ impl LookupLimit {
630 }
631 }
632
633- trait HasLabels {
634+ pub trait HasLabels {
635 fn has_labels(&self) -> bool;
636 }
637
638 @@ -611,7 +611,7 @@ mod test {
639 let mut mxs = Vec::new();
640 for (pos, item) in record.split(',').enumerate() {
641 let ip = item.trim().parse::<IpAddr>().unwrap();
642- let mx_name = format!("mx.{}.{}", ip, pos);
643+ let mx_name = format!("mx.{ip}.{pos}");
644 match ip {
645 IpAddr::V4(ip) => {
646 resolver.ipv4_add(mx_name.clone(), vec![ip], valid_until)
647 @@ -646,9 +646,7 @@ mod test {
648 assert_eq!(
649 output.result(),
650 result,
651- "Failed for {:?}, test {}.",
652- test_name,
653- test_num,
654+ "Failed for {test_name:?}, test {test_num}.",
655 );
656
657 if !exp.is_empty() {
658 @@ -656,7 +654,7 @@ mod test {
659 }
660 test_num += 1;
661 if test_name != last_test_name {
662- println!("Passed test {:?}", test_name);
663+ println!("Passed test {test_name:?}");
664 last_test_name = test_name;
665 }
666 }