Skip to content

Commit a5a91a1

Browse files
committed
v0.3.0
1 parent b7b1b4d commit a5a91a1

File tree

18 files changed

+97
-110
lines changed

18 files changed

+97
-110
lines changed

examples/report_arf_generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ fn main() {
4747
.unwrap();
4848

4949
// Print ARF feedback to stdout
50-
println!("{}", feedback);
50+
println!("{feedback}");
5151
}

examples/report_dmarc_generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ fn main() {
105105
.unwrap();
106106

107107
// Print report to stdout
108-
println!("{}", report);
108+
println!("{report}");
109109
}

src/arc/seal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ mod test {
326326
.selector(s)
327327
.headers(["From", "To", "Subject", "DKIM-Signature"])
328328
.seal(&message, &auth_results, &arc_result)
329-
.unwrap_or_else(|err| panic!("Got {:?} for {}", err, raw_message));
329+
.unwrap_or_else(|err| panic!("Got {err:?} for {raw_message}"));
330330
format!(
331331
"{}{}{}",
332332
arc.to_header(),

src/arc/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ mod test {
223223
{
224224
#[cfg(any(test, feature = "test"))]
225225
resolver.txt_add(
226-
format!("{}.", key),
226+
format!("{key}."),
227227
DomainKey::parse(value).unwrap(),
228228
Instant::now() + Duration::new(3200, 0),
229229
);

src/common/auth_results.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'x> AuthenticationResults<'x> {
7070
}
7171

7272
if dkim.is_atps {
73-
write!(self.auth_results, " header.from={}", header_from).ok();
73+
write!(self.auth_results, " header.from={header_from}").ok();
7474
}
7575
}
7676

@@ -84,10 +84,10 @@ impl<'x> AuthenticationResults<'x> {
8484
spf.result.as_spf_result(
8585
&mut self.auth_results,
8686
self.hostname,
87-
&format!("postmaster@{}", ehlo_domain),
87+
&format!("postmaster@{ehlo_domain}"),
8888
ip_addr,
8989
);
90-
write!(self.auth_results, " smtp.helo={}", ehlo_domain).ok();
90+
write!(self.auth_results, " smtp.helo={ehlo_domain}").ok();
9191
self
9292
}
9393

@@ -101,7 +101,7 @@ impl<'x> AuthenticationResults<'x> {
101101
let (mail_from, addr) = if !from.is_empty() {
102102
(Cow::from(from), from)
103103
} else {
104-
(format!("postmaster@{}", ehlo_domain).into(), "<>")
104+
(format!("postmaster@{ehlo_domain}").into(), "<>")
105105
};
106106
self.auth_results.push_str(";\r\n\tspf=");
107107
spf.result.as_spf_result(
@@ -110,14 +110,14 @@ impl<'x> AuthenticationResults<'x> {
110110
mail_from.as_ref(),
111111
ip_addr,
112112
);
113-
write!(self.auth_results, " smtp.mailfrom={}", addr).ok();
113+
write!(self.auth_results, " smtp.mailfrom={addr}").ok();
114114
self
115115
}
116116

117117
pub fn with_arc_result(mut self, arc: &ArcOutput, remote_ip: IpAddr) -> Self {
118118
self.auth_results.push_str(";\r\n\tarc=");
119119
arc.result.as_auth_result(&mut self.auth_results);
120-
write!(self.auth_results, " smtp.remote-ip={}", remote_ip).ok();
120+
write!(self.auth_results, " smtp.remote-ip={remote_ip}").ok();
121121
self
122122
}
123123

@@ -144,7 +144,7 @@ impl<'x> AuthenticationResults<'x> {
144144
pub fn with_iprev_result(mut self, iprev: &IprevOutput, remote_ip: IpAddr) -> Self {
145145
self.auth_results.push_str(";\r\n\tiprev=");
146146
iprev.result.as_auth_result(&mut self.auth_results);
147-
write!(self.auth_results, " policy.iprev={}", remote_ip).ok();
147+
write!(self.auth_results, " policy.iprev={remote_ip}").ok();
148148
self
149149
}
150150
}
@@ -189,16 +189,15 @@ impl ReceivedSpf {
189189
let mail_from = if !mail_from.is_empty() {
190190
Cow::from(mail_from)
191191
} else {
192-
format!("postmaster@{}", helo).into()
192+
format!("postmaster@{helo}").into()
193193
};
194194

195195
spf.result
196196
.as_spf_result(&mut received_spf, hostname, mail_from.as_ref(), ip_addr);
197197

198198
write!(
199199
received_spf,
200-
"\r\n\treceiver={}; client-ip={}; envelope-from=\"{}\"; helo={};",
201-
hostname, ip_addr, mail_from, helo
200+
"\r\n\treceiver={hostname}; client-ip={ip_addr}; envelope-from=\"{mail_from}\"; helo={helo};",
202201
)
203202
.ok();
204203

@@ -211,38 +210,31 @@ impl SpfResult {
211210
match &self {
212211
SpfResult::Pass => write!(
213212
header,
214-
"pass ({}: domain of {} designates {} as permitted sender)",
215-
hostname, mail_from, ip_addr
213+
"pass ({hostname}: domain of {mail_from} designates {ip_addr} as permitted sender)",
216214
),
217215
SpfResult::Fail => write!(
218216
header,
219-
"fail ({}: domain of {} does not designate {} as permitted sender)",
220-
hostname, mail_from, ip_addr
217+
"fail ({hostname}: domain of {mail_from} does not designate {ip_addr} as permitted sender)",
221218
),
222219
SpfResult::SoftFail => write!(
223220
header,
224-
"softfail ({}: domain of {} reports soft fail for {})",
225-
hostname, mail_from, ip_addr
221+
"softfail ({hostname}: domain of {mail_from} reports soft fail for {ip_addr})",
226222
),
227223
SpfResult::Neutral => write!(
228224
header,
229-
"neutral ({}: domain of {} reports neutral for {})",
230-
hostname, mail_from, ip_addr
225+
"neutral ({hostname}: domain of {mail_from} reports neutral for {ip_addr})",
231226
),
232227
SpfResult::TempError => write!(
233228
header,
234-
"temperror ({}: temporary dns error validating {})",
235-
hostname, mail_from
229+
"temperror ({hostname}: temporary dns error validating {mail_from})",
236230
),
237231
SpfResult::PermError => write!(
238232
header,
239-
"permerror ({}: unable to verify SPF record for {})",
240-
hostname, mail_from,
233+
"permerror ({hostname}: unable to verify SPF record for {mail_from})",
241234
),
242235
SpfResult::None => write!(
243236
header,
244-
"none ({}: no SPF records found for {})",
245-
hostname, mail_from
237+
"none ({hostname}: no SPF records found for {mail_from})",
246238
),
247239
}
248240
.ok();
@@ -343,7 +335,7 @@ impl AsAuthResult for Error {
343335
Error::DnsError(_) => "dns error",
344336
Error::DnsRecordNotFound(_) => "dns record not found",
345337
Error::ArcInvalidInstance(i) => {
346-
write!(header, "invalid ARC instance {})", i).ok();
338+
write!(header, "invalid ARC instance {i})").ok();
347339
return;
348340
}
349341
Error::ArcInvalidCV => "invalid ARC cv",

src/dkim/headers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Signature {
8080
for &ch in self.i.as_bytes().iter() {
8181
match ch {
8282
0..=0x20 | b';' | 0x7f..=u8::MAX => {
83-
writer.write_len(format!("={:02X}", ch).as_bytes(), &mut bw);
83+
writer.write_len(format!("={ch:02X}").as_bytes(), &mut bw);
8484
}
8585
_ => {
8686
writer.write_len(&[ch], &mut bw);

src/dkim/parse.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -605,20 +605,20 @@ mod test {
605605
),
606606
] {
607607
let result = Signature::parse(signature.as_bytes()).unwrap();
608-
assert_eq!(result.v, expected_result.v, "{:?}", signature);
609-
assert_eq!(result.a, expected_result.a, "{:?}", signature);
610-
assert_eq!(result.d, expected_result.d, "{:?}", signature);
611-
assert_eq!(result.s, expected_result.s, "{:?}", signature);
612-
assert_eq!(result.i, expected_result.i, "{:?}", signature);
613-
assert_eq!(result.b, expected_result.b, "{:?}", signature);
614-
assert_eq!(result.bh, expected_result.bh, "{:?}", signature);
615-
assert_eq!(result.h, expected_result.h, "{:?}", signature);
616-
assert_eq!(result.z, expected_result.z, "{:?}", signature);
617-
assert_eq!(result.l, expected_result.l, "{:?}", signature);
618-
assert_eq!(result.x, expected_result.x, "{:?}", signature);
619-
assert_eq!(result.t, expected_result.t, "{:?}", signature);
620-
assert_eq!(result.ch, expected_result.ch, "{:?}", signature);
621-
assert_eq!(result.cb, expected_result.cb, "{:?}", signature);
608+
assert_eq!(result.v, expected_result.v, "{signature:?}");
609+
assert_eq!(result.a, expected_result.a, "{signature:?}");
610+
assert_eq!(result.d, expected_result.d, "{signature:?}");
611+
assert_eq!(result.s, expected_result.s, "{signature:?}");
612+
assert_eq!(result.i, expected_result.i, "{signature:?}");
613+
assert_eq!(result.b, expected_result.b, "{signature:?}");
614+
assert_eq!(result.bh, expected_result.bh, "{signature:?}");
615+
assert_eq!(result.h, expected_result.h, "{signature:?}");
616+
assert_eq!(result.z, expected_result.z, "{signature:?}");
617+
assert_eq!(result.l, expected_result.l, "{signature:?}");
618+
assert_eq!(result.x, expected_result.x, "{signature:?}");
619+
assert_eq!(result.t, expected_result.t, "{signature:?}");
620+
assert_eq!(result.ch, expected_result.ch, "{signature:?}");
621+
assert_eq!(result.cb, expected_result.cb, "{signature:?}");
622622
}
623623
}
624624

src/dkim/sign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ mod test {
461461
DkimResult::Fail(hdr) | DkimResult::PermError(hdr) | DkimResult::Neutral(hdr),
462462
Err(err),
463463
) if hdr == err => (),
464-
(result, expect) => panic!("Expected {:?} but got {:?}.", expect, result),
464+
(result, expect) => panic!("Expected {expect:?} but got {result:?}."),
465465
}
466466

467467
dkim.into_iter()

src/dkim/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ mod test {
415415
{
416416
#[cfg(any(test, feature = "test"))]
417417
resolver.txt_add(
418-
format!("{}.", key),
418+
format!("{key}."),
419419
DomainKey::parse(value).unwrap(),
420420
Instant::now() + Duration::new(3200, 0),
421421
);

src/dmarc/parse.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,9 @@ mod test {
491491
] {
492492
assert_eq!(
493493
Dmarc::parse(record.as_bytes())
494-
.unwrap_or_else(|err| panic!("{:?} : {:?}", record, err)),
494+
.unwrap_or_else(|err| panic!("{record:?} : {err:?}")),
495495
expected_result,
496-
"{}",
497-
record
496+
"{record}"
498497
);
499498
}
500499
}

0 commit comments

Comments
 (0)