Fix clippy warnings

This commit is contained in:
Alexis Mousset
2019-11-30 12:18:03 +01:00
parent e0910ad351
commit bc60857ce4
3 changed files with 6 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ pub struct EmailAddress(String);
impl EmailAddress {
pub fn new(address: String) -> EmailResult<EmailAddress> {
if !EmailAddress::is_valid(&address) {
Err(Error::InvalidEmailAddress)?;
return Err(Error::InvalidEmailAddress);
}
Ok(EmailAddress(address))
}
@@ -108,7 +108,7 @@ impl Envelope {
/// Creates a new envelope, which may fail if `to` is empty.
pub fn new(from: Option<EmailAddress>, to: Vec<EmailAddress>) -> EmailResult<Envelope> {
if to.is_empty() {
Err(Error::MissingTo)?;
return Err(Error::MissingTo);
}
Ok(Envelope {
forward_path: to,

View File

@@ -20,6 +20,7 @@ pub struct EhloCommand {
impl Display for EhloCommand {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
#[allow(clippy::write_with_newline)]
write!(f, "EHLO {}\r\n", self.client_id)
}
}
@@ -165,7 +166,7 @@ pub struct VrfyCommand {
impl Display for VrfyCommand {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
#[cfg_attr(feature = "cargo-clippy", allow(clippy::write_with_newline))]
#[allow(clippy::write_with_newline)]
write!(f, "VRFY {}\r\n", self.argument)
}
}
@@ -186,6 +187,7 @@ pub struct ExpnCommand {
impl Display for ExpnCommand {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
#[allow(clippy::write_with_newline)]
write!(f, "EXPN {}\r\n", self.argument)
}
}

View File

@@ -439,7 +439,7 @@ impl EmailBuilder {
.message
.header(Header::new_with_value("From".into(), from).unwrap());
} else {
Err(Error::Envelope(LettreError::MissingFrom))?;
return Err(Error::Envelope(LettreError::MissingFrom));
}
if !self.cc.is_empty() {
self.message = self