fix(all): 2018 compatibility

This commit is contained in:
Alexis Mousset
2019-03-23 12:09:00 +01:00
parent cabc625009
commit d5e9ebc0db
13 changed files with 46 additions and 47 deletions

View File

@@ -3,14 +3,14 @@
//! It can be useful for testing purposes, or if you want to keep track of sent messages.
//!
use file::error::FileResult;
use crate::file::error::FileResult;
use serde_json;
use std::fs::File;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use Envelope;
use SendableEmail;
use Transport;
use crate::Envelope;
use crate::SendableEmail;
use crate::Transport;
pub mod error;

View File

@@ -45,19 +45,19 @@ pub mod sendmail;
pub mod smtp;
pub mod stub;
use error::EmailResult;
use error::Error;
use crate::error::EmailResult;
use crate::error::Error;
use fast_chemail::is_valid_email;
#[cfg(feature = "file-transport")]
pub use file::FileTransport;
pub use crate::file::FileTransport;
#[cfg(feature = "sendmail-transport")]
pub use sendmail::SendmailTransport;
pub use crate::sendmail::SendmailTransport;
#[cfg(feature = "smtp-transport")]
pub use smtp::client::net::ClientTlsParameters;
pub use crate::smtp::client::net::ClientTlsParameters;
#[cfg(all(feature = "smtp-transport", feature = "connection-pool"))]
pub use smtp::r2d2::SmtpConnectionManager;
#[cfg(feature = "smtp-transport")]
pub use smtp::{ClientSecurity, SmtpClient, SmtpTransport};
pub use crate::smtp::{ClientSecurity, SmtpClient, SmtpTransport};
use std::ffi::OsStr;
use std::fmt::{self, Display, Formatter};
use std::io;

View File

@@ -1,12 +1,12 @@
//! The sendmail transport sends the email using the local sendmail command.
//!
use sendmail::error::SendmailResult;
use crate::sendmail::error::SendmailResult;
use std::io::prelude::*;
use std::io::Read;
use std::process::{Command, Stdio};
use SendableEmail;
use Transport;
use crate::SendableEmail;
use crate::Transport;
pub mod error;

View File

@@ -1,6 +1,6 @@
//! Provides limited SASL authentication mechanisms
use smtp::error::Error;
use crate::smtp::error::Error;
use std::fmt::{self, Display, Formatter};
/// Accepted authentication mechanisms on an encrypted connection

View File

@@ -2,11 +2,11 @@
use bufstream::BufStream;
use nom::ErrorKind as NomErrorKind;
use smtp::authentication::{Credentials, Mechanism};
use smtp::client::net::{ClientTlsParameters, Connector, NetworkStream, Timeout};
use smtp::commands::*;
use smtp::error::{Error, SmtpResult};
use smtp::response::Response;
use crate::smtp::authentication::{Credentials, Mechanism};
use crate::smtp::client::net::{ClientTlsParameters, Connector, NetworkStream, Timeout};
use crate::smtp::commands::*;
use crate::smtp::error::{Error, SmtpResult};
use crate::smtp::response::Response;
use std::fmt::{Debug, Display};
use std::io::{self, BufRead, BufReader, Read, Write};
use std::net::ToSocketAddrs;

View File

@@ -1,7 +1,7 @@
//! A trait to represent a stream
use native_tls::{Protocol, TlsConnector, TlsStream};
use smtp::client::mock::MockStream;
use crate::smtp::client::mock::MockStream;
use std::io::{self, ErrorKind, Read, Write};
use std::net::{Ipv4Addr, Shutdown, SocketAddr, SocketAddrV4, TcpStream};
use std::time::Duration;

View File

@@ -3,13 +3,13 @@
//! SMTP commands
use base64;
use smtp::authentication::{Credentials, Mechanism};
use smtp::error::Error;
use smtp::extension::ClientId;
use smtp::extension::{MailParameter, RcptParameter};
use smtp::response::Response;
use crate::smtp::authentication::{Credentials, Mechanism};
use crate::smtp::error::Error;
use crate::smtp::extension::ClientId;
use crate::smtp::extension::{MailParameter, RcptParameter};
use crate::smtp::response::Response;
use std::fmt::{self, Display, Formatter};
use EmailAddress;
use crate::EmailAddress;
/// EHLO command
#[derive(PartialEq, Clone, Debug)]
@@ -290,7 +290,7 @@ impl AuthCommand {
#[cfg(test)]
mod test {
use super::*;
use smtp::extension::MailBodyParameter;
use crate::smtp::extension::MailBodyParameter;
#[test]
fn test_display() {

View File

@@ -4,7 +4,7 @@ use self::Error::*;
use base64::DecodeError;
use native_tls;
use nom;
use smtp::response::{Response, Severity};
use crate::smtp::response::{Response, Severity};
use std::error::Error as StdError;
use std::fmt;
use std::fmt::{Display, Formatter};

View File

@@ -1,10 +1,10 @@
//! ESMTP features
use hostname::get_hostname;
use smtp::authentication::Mechanism;
use smtp::error::Error;
use smtp::response::Response;
use smtp::util::XText;
use crate::smtp::authentication::Mechanism;
use crate::smtp::error::Error;
use crate::smtp::response::Response;
use crate::smtp::util::XText;
use std::collections::HashSet;
use std::fmt::{self, Display, Formatter};
use std::net::{Ipv4Addr, Ipv6Addr};
@@ -260,8 +260,8 @@ impl Display for RcptParameter {
mod test {
use super::{ClientId, Extension, ServerInfo};
use smtp::authentication::Mechanism;
use smtp::response::{Category, Code, Detail, Response, Severity};
use crate::smtp::authentication::Mechanism;
use crate::smtp::response::{Category, Code, Detail, Response, Severity};
use std::collections::HashSet;
#[test]

View File

@@ -14,18 +14,18 @@
//!
use native_tls::TlsConnector;
use smtp::authentication::{
use crate::smtp::authentication::{
Credentials, Mechanism, DEFAULT_ENCRYPTED_MECHANISMS, DEFAULT_UNENCRYPTED_MECHANISMS,
};
use smtp::client::net::ClientTlsParameters;
use smtp::client::net::DEFAULT_TLS_PROTOCOLS;
use smtp::client::InnerClient;
use smtp::commands::*;
use smtp::error::{Error, SmtpResult};
use smtp::extension::{ClientId, Extension, MailBodyParameter, MailParameter, ServerInfo};
use crate::smtp::client::net::ClientTlsParameters;
use crate::smtp::client::net::DEFAULT_TLS_PROTOCOLS;
use crate::smtp::client::InnerClient;
use crate::smtp::commands::*;
use crate::smtp::error::{Error, SmtpResult};
use crate::smtp::extension::{ClientId, Extension, MailBodyParameter, MailParameter, ServerInfo};
use std::net::{SocketAddr, ToSocketAddrs};
use std::time::Duration;
use {SendableEmail, Transport};
use crate::{SendableEmail, Transport};
pub mod authentication;
pub mod client;

View File

@@ -2,8 +2,8 @@
//! testing purposes.
//!
use SendableEmail;
use Transport;
use crate::SendableEmail;
use crate::Transport;
/// This transport logs the message envelope and returns the given response
#[derive(Debug, Clone, Copy)]

View File

@@ -22,8 +22,8 @@ extern crate uuid;
pub mod error;
pub use email_format::{Address, Header, Mailbox, MimeMessage, MimeMultipartType};
use error::Error;
pub use crate::email_format::{Address, Header, Mailbox, MimeMessage, MimeMultipartType};
use crate::error::Error;
use lettre::{error::Error as LettreError, EmailAddress, Envelope, SendableEmail};
use mime::Mime;
use std::fs;

View File

@@ -101,7 +101,6 @@ You can specify custom TLS settings:
```rust,no_run
extern crate native_tls;
extern crate lettre;
extern crate lettre_email;
use lettre::{
ClientSecurity, ClientTlsParameters, EmailAddress, Envelope,