Merge pull request #242 from amousset/more-lints

feat(all): Add more compiler lints
This commit is contained in:
Alexis Mousset
2018-03-31 20:00:12 +02:00
committed by GitHub
12 changed files with 29 additions and 23 deletions

View File

@@ -34,8 +34,8 @@ impl StdError for Error {
fn cause(&self) -> Option<&StdError> {
match *self {
Io(ref err) => Some(&*err as &StdError),
JsonSerialization(ref err) => Some(&*err as &StdError),
Io(ref err) => Some(&*err),
JsonSerialization(ref err) => Some(&*err),
_ => None,
}
}

View File

@@ -5,8 +5,9 @@
//!
#![doc(html_root_url = "https://docs.rs/lettre/0.8.0")]
#![deny(missing_docs, unsafe_code, unstable_features, warnings)]
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations,
trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features,
unused_import_braces, unused_qualifications)]
#[cfg(feature = "smtp-transport")]
extern crate base64;
#[cfg(feature = "smtp-transport")]
@@ -52,7 +53,7 @@ use std::error::Error as StdError;
use std::str::FromStr;
/// Error type for email content
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub enum Error {
/// Missing from in envelope
MissingFrom,

View File

@@ -30,7 +30,7 @@ impl StdError for Error {
fn cause(&self) -> Option<&StdError> {
match *self {
Io(ref err) => Some(&*err as &StdError),
Io(ref err) => Some(&*err),
_ => None,
}
}

View File

@@ -18,7 +18,7 @@ pub mod net;
pub mod mock;
/// The codec used for transparency
#[derive(Default, Debug)]
#[derive(Default, Clone, Copy, Debug)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct ClientCodec {
escape_count: u8,

View File

@@ -8,6 +8,7 @@ use std::time::Duration;
/// Parameters to use for secure clients
#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub struct ClientTlsParameters {
/// A connector from `native-tls`
pub connector: TlsConnector,

View File

@@ -32,7 +32,7 @@ impl EhloCommand {
}
/// STARTTLS command
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct StarttlsCommand;
@@ -104,7 +104,7 @@ impl RcptCommand {
}
/// DATA command
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct DataCommand;
@@ -116,7 +116,7 @@ impl Display for DataCommand {
}
/// QUIT command
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct QuitCommand;
@@ -128,7 +128,7 @@ impl Display for QuitCommand {
}
/// NOOP command
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct NoopCommand;
@@ -206,7 +206,7 @@ impl ExpnCommand {
}
/// RSET command
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub struct RsetCommand;

View File

@@ -73,11 +73,11 @@ impl StdError for Error {
fn cause(&self) -> Option<&StdError> {
match *self {
ChallengeParsing(ref err) => Some(&*err as &StdError),
Utf8Parsing(ref err) => Some(&*err as &StdError),
Io(ref err) => Some(&*err as &StdError),
Tls(ref err) => Some(&*err as &StdError),
Parsing(ref err) => Some(&*err as &StdError),
ChallengeParsing(ref err) => Some(&*err),
Utf8Parsing(ref err) => Some(&*err),
Io(ref err) => Some(&*err),
Tls(ref err) => Some(&*err),
Parsing(ref err) => Some(&*err),
_ => None,
}
}

View File

@@ -212,7 +212,7 @@ impl Display for MailParameter {
}
/// Values for the `BODY` parameter to `MAIL FROM`
#[derive(PartialEq, Eq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub enum MailBodyParameter {
/// `7BIT`

View File

@@ -66,6 +66,7 @@ pub const NUL: &str = "\0";
/// How to apply TLS to a client connection
#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub enum ClientSecurity {
/// Insecure connection
None,
@@ -79,7 +80,7 @@ pub enum ClientSecurity {
}
/// Configures connection reuse behavior
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Copy)]
#[cfg_attr(feature = "serde-impls", derive(Serialize, Deserialize))]
pub enum ConnectionReuseParameters {
/// Unlimitied connection reuse
@@ -91,6 +92,7 @@ pub enum ConnectionReuseParameters {
}
/// Contains client configuration
#[allow(missing_debug_implementations)]
pub struct SmtpTransportBuilder {
/// Enable connection reuse
connection_reuse: ConnectionReuseParameters,
@@ -199,6 +201,7 @@ struct State {
}
/// Structure that implements the high level SMTP client
#[allow(missing_debug_implementations)]
pub struct SmtpTransport {
/// Information about the server
/// Value is None before HELO/EHLO

View File

@@ -1,7 +1,6 @@
//! SMTP response, containing a mandatory return code and an optional text
//! message
use self::Severity::*;
use nom::{crlf, ErrorKind as NomErrorKind, IResult as NomResult};
use nom::simple_errors::Err as NomError;
use std::fmt::{Display, Formatter, Result};
@@ -147,7 +146,7 @@ impl Response {
/// Tells if the response is positive
pub fn is_positive(&self) -> bool {
match self.code.severity {
PositiveCompletion | PositiveIntermediate => true,
Severity::PositiveCompletion | Severity::PositiveIntermediate => true,
_ => false,
}
}

View File

@@ -7,7 +7,7 @@ use SendableEmail;
use std::io::Read;
/// This transport logs the message envelope and returns the given response
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct StubEmailTransport {
response: StubResult,
}

View File

@@ -2,7 +2,9 @@
//!
#![doc(html_root_url = "https://docs.rs/lettre_email/0.8.0")]
#![deny(missing_docs, unsafe_code, unstable_features, warnings, missing_debug_implementations)]
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations,
trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features,
unused_import_braces, unused_qualifications)]
extern crate base64;
extern crate email as email_format;