Fix a few clippy warnings (#579)

This commit is contained in:
Paolo Barbolini
2021-03-19 09:03:41 +01:00
committed by GitHub
parent fe8dc4967d
commit f041c00df7
4 changed files with 4 additions and 5 deletions

View File

@@ -175,7 +175,7 @@ fn make_boundary() -> String {
impl MultiPartKind {
fn to_mime<S: Into<String>>(&self, boundary: Option<S>) -> Mime {
let boundary = boundary.map_or_else(make_boundary, |s| s.into());
let boundary = boundary.map_or_else(make_boundary, Into::into);
format!(
"multipart/{}; boundary=\"{}\"{}",

View File

@@ -55,7 +55,7 @@ impl Display for Mail {
write!(
f,
"MAIL FROM:<{}>",
self.sender.as_ref().map(|s| s.as_ref()).unwrap_or("")
self.sender.as_ref().map_or("", |s| s.as_ref())
)?;
for parameter in &self.parameters {
write!(f, " {}", parameter)?;

View File

@@ -76,8 +76,7 @@ impl Error {
/// Returns the status code, if the error was generated from a response.
pub fn status(&self) -> Option<Code> {
match self.inner.kind {
Kind::Transient(code) => Some(code),
Kind::Permanent(code) => Some(code),
Kind::Transient(code) | Kind::Permanent(code) => Some(code),
_ => None,
}
}

View File

@@ -122,7 +122,7 @@ impl Code {
}
/// Tells if the response is positive
pub fn is_positive(&self) -> bool {
pub fn is_positive(self) -> bool {
matches!(
self.severity,
Severity::PositiveCompletion | Severity::PositiveIntermediate