Merge pull request #105 from amousset/style-improvement
style(all): Improve coding style (using rust-clippy)
This commit is contained in:
@@ -42,7 +42,7 @@ lettre = "0.6"
|
||||
|
||||
## Testing
|
||||
|
||||
The tests require an open mail server listening locally on port 25.
|
||||
The tests require an open mail server listening locally on port 25 and the `sendmail` command.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ pub struct EmailBuilder {
|
||||
}
|
||||
|
||||
/// Simple email enveloppe representation
|
||||
#[derive(PartialEq,Eq,Clone,Debug)]
|
||||
#[derive(PartialEq,Eq,Clone,Debug,Default)]
|
||||
pub struct Envelope {
|
||||
/// The envelope recipients' addresses
|
||||
to: Vec<String>,
|
||||
@@ -622,7 +622,7 @@ impl EmailBuilder {
|
||||
// If there are multiple addresses in "From", the "Sender" is required.
|
||||
if self.from_header.len() >= 2 && self.sender_header.is_none() {
|
||||
// So, we must find something to put as Sender.
|
||||
for possible_sender in self.from_header.iter() {
|
||||
for possible_sender in &self.from_header {
|
||||
// Only a mailbox can be used as sender, not Address::Group.
|
||||
if let &Address::Mailbox(ref mbx) = possible_sender {
|
||||
self.sender_header = Some(mbx.clone());
|
||||
|
||||
@@ -50,5 +50,5 @@ impl From<&'static str> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
/// SendMail result type
|
||||
/// sendmail result type
|
||||
pub type SendmailResult = Result<(), Error>;
|
||||
|
||||
@@ -135,7 +135,7 @@ impl<S: Connector + Write + Read + Debug> Client<S> {
|
||||
/// Sends a MAIL command
|
||||
pub fn mail(&mut self, address: &str, options: Option<&str>) -> SmtpResult {
|
||||
match options {
|
||||
Some(ref options) => self.command(&format!("MAIL FROM:<{}> {}", address, options)),
|
||||
Some(options) => self.command(&format!("MAIL FROM:<{}> {}", address, options)),
|
||||
None => self.command(&format!("MAIL FROM:<{}>", address)),
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ impl<S: Connector + Write + Read + Debug> Client<S> {
|
||||
/// Sends a HELP command
|
||||
pub fn help(&mut self, argument: Option<&str>) -> SmtpResult {
|
||||
match argument {
|
||||
Some(ref argument) => self.command(&format!("HELP {}", argument)),
|
||||
Some(argument) => self.command(&format!("HELP {}", argument)),
|
||||
None => self.command("HELP"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user