Make clippy happy

- Applied many of the `clippy` suggestions.
This commit is contained in:
Malte Meiboom
2026-04-27 13:42:47 +02:00
parent 799f6eb588
commit 4e28e636a1
6 changed files with 44 additions and 43 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ impl<'hc> HuskContext<'hc> {
pub async fn add_recipient(&mut self, rcpt: String) {
let certs = crypto::get_certificates(&self, rcpt.as_str()).await;
let certs = crypto::get_certificates(self, rcpt.as_str()).await;
self.mail.add_recipient(rcpt, certs)
}
+1 -1
View File
@@ -64,7 +64,7 @@ impl Display for Introducer {
.map(|u| String::from_utf8_lossy(u.userid().value()).to_string())
.collect::<Vec<String>>()
.join(", ");
write!(f, "Introducer: {}\n", self.cert.fingerprint())?;
writeln!(f, "Introducer: {}", self.cert.fingerprint())?;
write!(f, " UserIDs: {}", uids)?;
Ok(())
}
+7
View File
@@ -66,6 +66,13 @@ impl<'mc> MailContext<'mc> {
}
/// Default Mailcontext
impl<'mc> Default for MailContext<'mc> {
fn default() -> Self {
Self::new()
}
}
impl From<&MailContext<'_>> for ProtectionPossibility {
fn from(mail_context: &MailContext<'_>) -> ProtectionPossibility {
let mut can_encrypt = false;
+3 -3
View File
@@ -17,8 +17,8 @@ pub struct Recipient<'r> {
impl From<String> for Recipient<'_> {
fn from(email: String) -> Self {
Recipient {
email: email,
Recipient {
email,
certs: Vec::new()
}
}
@@ -40,7 +40,7 @@ impl Recipient<'_> {
/// check if this Recipient can encrypt.
// XXX: currently this check is naive
pub fn can_encrypt(&self) -> bool {
if self.certs.len() == 0 {
if self.certs.is_empty() {
return false;
}