From d5e9ebc0db156461a6a7d6712b71f7fde8e49b97 Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Sat, 23 Mar 2019 12:09:00 +0100 Subject: [PATCH] fix(all): 2018 compatibility --- lettre/src/file/mod.rs | 8 ++++---- lettre/src/lib.rs | 12 ++++++------ lettre/src/sendmail/mod.rs | 6 +++--- lettre/src/smtp/authentication.rs | 2 +- lettre/src/smtp/client/mod.rs | 10 +++++----- lettre/src/smtp/client/net.rs | 2 +- lettre/src/smtp/commands.rs | 14 +++++++------- lettre/src/smtp/error.rs | 2 +- lettre/src/smtp/extension.rs | 12 ++++++------ lettre/src/smtp/mod.rs | 16 ++++++++-------- lettre/src/stub/mod.rs | 4 ++-- lettre_email/src/lib.rs | 4 ++-- website/content/sending-messages/smtp.md | 1 - 13 files changed, 46 insertions(+), 47 deletions(-) diff --git a/lettre/src/file/mod.rs b/lettre/src/file/mod.rs index d241ab7..b3ba1c3 100644 --- a/lettre/src/file/mod.rs +++ b/lettre/src/file/mod.rs @@ -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; diff --git a/lettre/src/lib.rs b/lettre/src/lib.rs index ac485d2..0a33cc1 100644 --- a/lettre/src/lib.rs +++ b/lettre/src/lib.rs @@ -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; diff --git a/lettre/src/sendmail/mod.rs b/lettre/src/sendmail/mod.rs index dc2ba80..2238388 100644 --- a/lettre/src/sendmail/mod.rs +++ b/lettre/src/sendmail/mod.rs @@ -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; diff --git a/lettre/src/smtp/authentication.rs b/lettre/src/smtp/authentication.rs index 541bb08..8b91562 100644 --- a/lettre/src/smtp/authentication.rs +++ b/lettre/src/smtp/authentication.rs @@ -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 diff --git a/lettre/src/smtp/client/mod.rs b/lettre/src/smtp/client/mod.rs index d0c759e..df1678d 100644 --- a/lettre/src/smtp/client/mod.rs +++ b/lettre/src/smtp/client/mod.rs @@ -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; diff --git a/lettre/src/smtp/client/net.rs b/lettre/src/smtp/client/net.rs index 12d0375..49c6e2b 100644 --- a/lettre/src/smtp/client/net.rs +++ b/lettre/src/smtp/client/net.rs @@ -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; diff --git a/lettre/src/smtp/commands.rs b/lettre/src/smtp/commands.rs index 392424b..991aa9e 100644 --- a/lettre/src/smtp/commands.rs +++ b/lettre/src/smtp/commands.rs @@ -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() { diff --git a/lettre/src/smtp/error.rs b/lettre/src/smtp/error.rs index 0f46679..e67161c 100644 --- a/lettre/src/smtp/error.rs +++ b/lettre/src/smtp/error.rs @@ -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}; diff --git a/lettre/src/smtp/extension.rs b/lettre/src/smtp/extension.rs index e8f2e0d..7c78060 100644 --- a/lettre/src/smtp/extension.rs +++ b/lettre/src/smtp/extension.rs @@ -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] diff --git a/lettre/src/smtp/mod.rs b/lettre/src/smtp/mod.rs index 7a3ffe4..a5eccd3 100644 --- a/lettre/src/smtp/mod.rs +++ b/lettre/src/smtp/mod.rs @@ -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; diff --git a/lettre/src/stub/mod.rs b/lettre/src/stub/mod.rs index c221ab6..5c94f2e 100644 --- a/lettre/src/stub/mod.rs +++ b/lettre/src/stub/mod.rs @@ -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)] diff --git a/lettre_email/src/lib.rs b/lettre_email/src/lib.rs index 35d9c35..942f0ed 100644 --- a/lettre_email/src/lib.rs +++ b/lettre_email/src/lib.rs @@ -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; diff --git a/website/content/sending-messages/smtp.md b/website/content/sending-messages/smtp.md index ffa14bc..7337e1b 100644 --- a/website/content/sending-messages/smtp.md +++ b/website/content/sending-messages/smtp.md @@ -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,