From 648bf2b2f60eadb5601f5f7f6ef98ddb6fc1a678 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Sun, 14 Mar 2021 09:22:59 +0100 Subject: [PATCH] chore: remove some uses of * (#569) --- src/message/mimebody.rs | 26 ++++++++++++-------------- src/transport/sendmail/mod.rs | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/message/mimebody.rs b/src/message/mimebody.rs index c54294f..3a90a31 100644 --- a/src/message/mimebody.rs +++ b/src/message/mimebody.rs @@ -177,20 +177,19 @@ impl MultiPartKind { fn to_mime>(&self, boundary: Option) -> Mime { let boundary = boundary.map_or_else(make_boundary, |s| s.into()); - use self::MultiPartKind::*; format!( "multipart/{}; boundary=\"{}\"{}", match self { - Mixed => "mixed", - Alternative => "alternative", - Related => "related", - Encrypted { .. } => "encrypted", - Signed { .. } => "signed", + Self::Mixed => "mixed", + Self::Alternative => "alternative", + Self::Related => "related", + Self::Encrypted { .. } => "encrypted", + Self::Signed { .. } => "signed", }, boundary, match self { - Encrypted { protocol } => format!("; protocol=\"{}\"", protocol), - Signed { protocol, micalg } => + Self::Encrypted { protocol } => format!("; protocol=\"{}\"", protocol), + Self::Signed { protocol, micalg } => format!("; protocol=\"{}\"; micalg=\"{}\"", protocol, micalg), _ => String::new(), } @@ -200,18 +199,17 @@ impl MultiPartKind { } fn from_mime(m: &Mime) -> Option { - use self::MultiPartKind::*; match m.subtype().as_ref() { - "mixed" => Some(Mixed), - "alternative" => Some(Alternative), - "related" => Some(Related), + "mixed" => Some(Self::Mixed), + "alternative" => Some(Self::Alternative), + "related" => Some(Self::Related), "signed" => m.get_param("protocol").and_then(|p| { - m.get_param("micalg").map(|micalg| Signed { + m.get_param("micalg").map(|micalg| Self::Signed { protocol: p.as_str().to_owned(), micalg: micalg.as_str().to_owned(), }) }), - "encrypted" => m.get_param("protocol").map(|p| Encrypted { + "encrypted" => m.get_param("protocol").map(|p| Self::Encrypted { protocol: p.as_str().to_owned(), }), _ => None, diff --git a/src/transport/sendmail/mod.rs b/src/transport/sendmail/mod.rs index d2d9ebc..ddde571 100644 --- a/src/transport/sendmail/mod.rs +++ b/src/transport/sendmail/mod.rs @@ -111,7 +111,7 @@ use async_trait::async_trait; use std::marker::PhantomData; use std::{ ffi::OsString, - io::prelude::*, + io::Write, process::{Command, Stdio}, };