Merge pull request #24 from amousset/rustfmt

style(formatting): Run rustfmt
This commit is contained in:
Alexis Mousset
2015-10-26 22:58:09 +01:00
14 changed files with 31 additions and 50 deletions

View File

@@ -1,20 +0,0 @@
extern crate lettre;
use lettre::transport::file::FileEmailTransport;
use lettre::transport::EmailTransport;
use lettre::email::EmailBuilder;
fn main() {
let mut sender = FileEmailTransport::new("/tmp/");
let email = EmailBuilder::new()
.to("root@localhost")
.from("user@localhost")
.body("Hello World!")
.subject("Hello")
.build()
.unwrap();
let result = sender.send(email);
println!("{:?}", result);
assert!(result.is_ok());
}

1
rustfmt.toml Normal file
View File

@@ -0,0 +1 @@
reorder_imports = true

View File

@@ -1,10 +1,10 @@
//! Simple email (very incomplete) //! Simple email (very incomplete)
use std::fmt::{Display, Formatter};
use std::fmt; use std::fmt;
use std::fmt::{Display, Formatter};
use email_format::{MimeMessage, Header, Mailbox}; use email_format::{Header, Mailbox, MimeMessage};
use time::{now, Tm}; use time::{Tm, now};
use uuid::Uuid; use uuid::Uuid;
/// Converts an adress or an address with an alias to a `Address` /// Converts an adress or an address with an alias to a `Address`
@@ -269,9 +269,9 @@ mod test {
use time::now; use time::now;
use uuid::Uuid; use uuid::Uuid;
use email_format::{MimeMessage, Header}; use email_format::{Header, MimeMessage};
use super::{SendableEmail, EmailBuilder, Email}; use super::{Email, EmailBuilder, SendableEmail};
#[test] #[test]
fn test_email_display() { fn test_email_display() {

View File

@@ -147,7 +147,7 @@
//! let _ = email_client.quit(); //! let _ = email_client.quit();
//! ``` //! ```
#![deny(missing_docs)] #![deny(missing_docs, unsafe_code, unstable_features)]
#[macro_use] #[macro_use]
extern crate log; extern crate log;

View File

@@ -2,10 +2,10 @@
use std::error::Error as StdError; use std::error::Error as StdError;
use std::io; use std::io;
use std::fmt::{Display, Formatter};
use std::fmt; use std::fmt;
use std::fmt::{Display, Formatter};
use transport::smtp::response::{Severity, Response}; use transport::smtp::response::{Response, Severity};
use rustc_serialize::base64::FromBase64Error; use rustc_serialize::base64::FromBase64Error;
use self::Error::*; use self::Error::*;

View File

@@ -4,13 +4,12 @@ use std::path::{Path, PathBuf};
use std::io::prelude::*; use std::io::prelude::*;
use std::fs::File; use std::fs::File;
use transport::EmailTransport;
use transport::error::EmailResult; use transport::error::EmailResult;
use transport::smtp::response::Response; use transport::smtp::response::Response;
use transport::EmailTransport; use transport::smtp::response::{Category, Code, Severity};
use transport::smtp::response::{Code, Category, Severity};
use email::SendableEmail; use email::SendableEmail;
/// TODO /// TODO
pub struct FileEmailTransport { pub struct FileEmailTransport {
path: PathBuf, path: PathBuf,

View File

@@ -1,9 +1,9 @@
//! Provides authentication mecanisms //! Provides authentication mecanisms
use std::fmt::{Display, Formatter};
use std::fmt; use std::fmt;
use std::fmt::{Display, Formatter};
use rustc_serialize::base64::{self, ToBase64, FromBase64}; use rustc_serialize::base64::{self, FromBase64, ToBase64};
use rustc_serialize::hex::ToHex; use rustc_serialize::hex::ToHex;
use crypto::hmac::Hmac; use crypto::hmac::Hmac;
use crypto::md5::Md5; use crypto::md5::Md5;

View File

@@ -2,16 +2,16 @@
use std::string::String; use std::string::String;
use std::net::ToSocketAddrs; use std::net::ToSocketAddrs;
use std::io::{BufRead, Read, Write};
use std::io; use std::io;
use std::io::{BufRead, Read, Write};
use std::fmt::Debug; use std::fmt::Debug;
use bufstream::BufStream; use bufstream::BufStream;
use openssl::ssl::SslContext; use openssl::ssl::SslContext;
use transport::error::{EmailResult, Error};
use transport::smtp::response::ResponseParser; use transport::smtp::response::ResponseParser;
use transport::smtp::authentication::Mecanism; use transport::smtp::authentication::Mecanism;
use transport::error::{Error, EmailResult};
use transport::smtp::client::net::{Connector, NetworkStream}; use transport::smtp::client::net::{Connector, NetworkStream};
use transport::smtp::{CRLF, MESSAGE_ENDING}; use transport::smtp::{CRLF, MESSAGE_ENDING};
@@ -246,7 +246,7 @@ impl<S: Connector + Write + Read + Debug + Clone = NetworkStream> Client<S> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::{escape_dot, remove_crlf, escape_crlf}; use super::{escape_crlf, escape_dot, remove_crlf};
#[test] #[test]
fn test_escape_dot() { fn test_escape_dot() {

View File

@@ -1,9 +1,8 @@
//! A trait to represent a stream //! A trait to represent a stream
use std::io; use std::io;
use std::io::{Read, Write, ErrorKind}; use std::io::{ErrorKind, Read, Write};
use std::net::SocketAddr; use std::net::{SocketAddr, TcpStream};
use std::net::TcpStream;
use std::fmt; use std::fmt;
use std::fmt::{Debug, Formatter}; use std::fmt::{Debug, Formatter};

View File

@@ -1,12 +1,12 @@
//! ESMTP features //! ESMTP features
use std::result::Result; use std::result::Result;
use std::fmt::{Display, Formatter};
use std::fmt; use std::fmt;
use std::fmt::{Display, Formatter};
use std::collections::HashSet; use std::collections::HashSet;
use transport::smtp::response::Response;
use transport::error::Error; use transport::error::Error;
use transport::smtp::response::Response;
use transport::smtp::authentication::Mecanism; use transport::smtp::authentication::Mecanism;
/// Supported ESMTP keywords /// Supported ESMTP keywords
@@ -125,9 +125,9 @@ impl ServerInfo {
mod test { mod test {
use std::collections::HashSet; use std::collections::HashSet;
use super::{ServerInfo, Extension}; use super::{Extension, ServerInfo};
use transport::smtp::authentication::Mecanism; use transport::smtp::authentication::Mecanism;
use transport::smtp::response::{Code, Response, Severity, Category}; use transport::smtp::response::{Category, Code, Response, Severity};
#[test] #[test]
fn test_extension_fmt() { fn test_extension_fmt() {

View File

@@ -3,10 +3,10 @@
use std::string::String; use std::string::String;
use std::net::{SocketAddr, ToSocketAddrs}; use std::net::{SocketAddr, ToSocketAddrs};
use openssl::ssl::{SslMethod, SslContext}; use openssl::ssl::{SslContext, SslMethod};
use transport::smtp::extension::{Extension, ServerInfo};
use transport::error::{EmailResult, Error}; use transport::error::{EmailResult, Error};
use transport::smtp::extension::{Extension, ServerInfo};
use transport::smtp::client::Client; use transport::smtp::client::Client;
use transport::smtp::authentication::Mecanism; use transport::smtp::authentication::Mecanism;
use transport::EmailTransport; use transport::EmailTransport;

View File

@@ -276,7 +276,7 @@ impl Response {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::{Severity, Category, Response, ResponseParser, Code}; use super::{Category, Code, Response, ResponseParser, Severity};
#[test] #[test]
fn test_severity_from_str() { fn test_severity_from_str() {

View File

@@ -2,9 +2,8 @@
//! succes //! succes
use transport::error::EmailResult; use transport::error::EmailResult;
use transport::smtp::response::Response; use transport::smtp::response::{Category, Code, Response, Severity};
use transport::EmailTransport; use transport::EmailTransport;
use transport::smtp::response::{Code, Category, Severity};
use email::SendableEmail; use email::SendableEmail;
/// This transport does nothing exept logging the message enveloppe /// This transport does nothing exept logging the message enveloppe

View File

@@ -7,7 +7,7 @@ use std::io::Read;
use lettre::transport::file::FileEmailTransport; use lettre::transport::file::FileEmailTransport;
use lettre::transport::EmailTransport; use lettre::transport::EmailTransport;
use lettre::email::{SendableEmail, EmailBuilder}; use lettre::email::{EmailBuilder, SendableEmail};
#[test] #[test]
fn file_transport() { fn file_transport() {
@@ -28,7 +28,10 @@ fn file_transport() {
let mut buffer = String::new(); let mut buffer = String::new();
let _ = f.read_to_string(&mut buffer); let _ = f.read_to_string(&mut buffer);
assert_eq!(buffer, format!("{}: from=<user@localhost> to=<root@localhost>\n{}", message_id, email.message())); assert_eq!(buffer,
format!("{}: from=<user@localhost> to=<root@localhost>\n{}",
message_id,
email.message()));
remove_file(file).unwrap(); remove_file(file).unwrap();
} }