cargo: apply cargo fmt --all
This commit is contained in:
parent
dc2d67d9eb
commit
875ab41c7d
|
@ -888,7 +888,9 @@ impl PacketDumper {
|
||||||
i,
|
i,
|
||||||
t.convert(),
|
t.convert(),
|
||||||
if let Some(creation) = sig.signature_creation_time() {
|
if let Some(creation) = sig.signature_creation_time() {
|
||||||
(creation + std::time::Duration::from(*t)).convert().to_string()
|
(creation + std::time::Duration::from(*t))
|
||||||
|
.convert()
|
||||||
|
.to_string()
|
||||||
} else {
|
} else {
|
||||||
" (no Signature Creation Time subpacket)".into()
|
" (no Signature Creation Time subpacket)".into()
|
||||||
}
|
}
|
||||||
|
|
20
src/mail.rs
20
src/mail.rs
|
@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use crate::counters;
|
use crate::counters;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use lettre::message::{Mailbox, MultiPart, SinglePart, header};
|
use lettre::message::{header, Mailbox, MultiPart, SinglePart};
|
||||||
use lettre::{FileTransport, SendmailTransport, Transport as LettreTransport};
|
use lettre::{FileTransport, SendmailTransport, Transport as LettreTransport};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -79,7 +79,9 @@ impl Service {
|
||||||
.host_str()
|
.host_str()
|
||||||
.ok_or_else(|| anyhow!("No host in base-URI"))?
|
.ok_or_else(|| anyhow!("No host in base-URI"))?
|
||||||
.to_string();
|
.to_string();
|
||||||
let from = from.parse().map_err(|_| anyhow!("From must be valid email address"))?;
|
let from = from
|
||||||
|
.parse()
|
||||||
|
.map_err(|_| anyhow!("From must be valid email address"))?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
from,
|
from,
|
||||||
domain,
|
domain,
|
||||||
|
@ -233,12 +235,14 @@ impl Service {
|
||||||
SinglePart::builder()
|
SinglePart::builder()
|
||||||
.header(header::ContentTransferEncoding::EightBit)
|
.header(header::ContentTransferEncoding::EightBit)
|
||||||
.header(header::ContentType::TEXT_PLAIN)
|
.header(header::ContentType::TEXT_PLAIN)
|
||||||
.body(txt)
|
.body(txt),
|
||||||
)
|
)
|
||||||
.singlepart(SinglePart::builder()
|
.singlepart(
|
||||||
|
SinglePart::builder()
|
||||||
.header(header::ContentTransferEncoding::EightBit)
|
.header(header::ContentTransferEncoding::EightBit)
|
||||||
.header(header::ContentType::TEXT_HTML)
|
.header(header::ContentType::TEXT_HTML)
|
||||||
.body(html)),
|
.body(html),
|
||||||
|
),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
match self.transport {
|
match self.transport {
|
||||||
|
@ -448,9 +452,9 @@ mod test {
|
||||||
assert!(mail_content.contains("testtoken"));
|
assert!(mail_content.contains("testtoken"));
|
||||||
assert!(mail_content.contains("test/about"));
|
assert!(mail_content.contains("test/about"));
|
||||||
assert!(mail_content.contains("この鍵の掲示されたア"));
|
assert!(mail_content.contains("この鍵の掲示されたア"));
|
||||||
assert!(mail_content.contains(
|
assert!(
|
||||||
"Subject: =?utf-8?b?bG9jYWxob3N044Gu6Y2144KS566h55CG44GZ44KL?="
|
mail_content.contains("Subject: =?utf-8?b?bG9jYWxob3N044Gu6Y2144KS566h55CG44GZ44KL?=")
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue