Merge pull request #24 from amousset/rustfmt
style(formatting): Run rustfmt
This commit is contained in:
@@ -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
1
rustfmt.toml
Normal file
@@ -0,0 +1 @@
|
||||
reorder_imports = true
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Simple email (very incomplete)
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::fmt;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
use email_format::{MimeMessage, Header, Mailbox};
|
||||
use time::{now, Tm};
|
||||
use email_format::{Header, Mailbox, MimeMessage};
|
||||
use time::{Tm, now};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Converts an adress or an address with an alias to a `Address`
|
||||
@@ -269,9 +269,9 @@ mod test {
|
||||
use time::now;
|
||||
|
||||
use uuid::Uuid;
|
||||
use email_format::{MimeMessage, Header};
|
||||
use email_format::{Header, MimeMessage};
|
||||
|
||||
use super::{SendableEmail, EmailBuilder, Email};
|
||||
use super::{Email, EmailBuilder, SendableEmail};
|
||||
|
||||
#[test]
|
||||
fn test_email_display() {
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
//! let _ = email_client.quit();
|
||||
//! ```
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![deny(missing_docs, unsafe_code, unstable_features)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
use std::error::Error as StdError;
|
||||
use std::io;
|
||||
use std::fmt::{Display, Formatter};
|
||||
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 self::Error::*;
|
||||
|
||||
|
||||
@@ -4,13 +4,12 @@ use std::path::{Path, PathBuf};
|
||||
use std::io::prelude::*;
|
||||
use std::fs::File;
|
||||
|
||||
use transport::EmailTransport;
|
||||
use transport::error::EmailResult;
|
||||
use transport::smtp::response::Response;
|
||||
use transport::EmailTransport;
|
||||
use transport::smtp::response::{Code, Category, Severity};
|
||||
use transport::smtp::response::{Category, Code, Severity};
|
||||
use email::SendableEmail;
|
||||
|
||||
|
||||
/// TODO
|
||||
pub struct FileEmailTransport {
|
||||
path: PathBuf,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Provides authentication mecanisms
|
||||
|
||||
use std::fmt::{Display, Formatter};
|
||||
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 crypto::hmac::Hmac;
|
||||
use crypto::md5::Md5;
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
use std::string::String;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::io::{BufRead, Read, Write};
|
||||
use std::io;
|
||||
use std::io::{BufRead, Read, Write};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use bufstream::BufStream;
|
||||
use openssl::ssl::SslContext;
|
||||
|
||||
use transport::error::{EmailResult, Error};
|
||||
use transport::smtp::response::ResponseParser;
|
||||
use transport::smtp::authentication::Mecanism;
|
||||
use transport::error::{Error, EmailResult};
|
||||
use transport::smtp::client::net::{Connector, NetworkStream};
|
||||
use transport::smtp::{CRLF, MESSAGE_ENDING};
|
||||
|
||||
@@ -246,7 +246,7 @@ impl<S: Connector + Write + Read + Debug + Clone = NetworkStream> Client<S> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{escape_dot, remove_crlf, escape_crlf};
|
||||
use super::{escape_crlf, escape_dot, remove_crlf};
|
||||
|
||||
#[test]
|
||||
fn test_escape_dot() {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
//! A trait to represent a stream
|
||||
|
||||
use std::io;
|
||||
use std::io::{Read, Write, ErrorKind};
|
||||
use std::net::SocketAddr;
|
||||
use std::net::TcpStream;
|
||||
use std::io::{ErrorKind, Read, Write};
|
||||
use std::net::{SocketAddr, TcpStream};
|
||||
use std::fmt;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! ESMTP features
|
||||
|
||||
use std::result::Result;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::fmt;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::collections::HashSet;
|
||||
|
||||
use transport::smtp::response::Response;
|
||||
use transport::error::Error;
|
||||
use transport::smtp::response::Response;
|
||||
use transport::smtp::authentication::Mecanism;
|
||||
|
||||
/// Supported ESMTP keywords
|
||||
@@ -125,9 +125,9 @@ impl ServerInfo {
|
||||
mod test {
|
||||
use std::collections::HashSet;
|
||||
|
||||
use super::{ServerInfo, Extension};
|
||||
use super::{Extension, ServerInfo};
|
||||
use transport::smtp::authentication::Mecanism;
|
||||
use transport::smtp::response::{Code, Response, Severity, Category};
|
||||
use transport::smtp::response::{Category, Code, Response, Severity};
|
||||
|
||||
#[test]
|
||||
fn test_extension_fmt() {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
use std::string::String;
|
||||
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::smtp::extension::{Extension, ServerInfo};
|
||||
use transport::smtp::client::Client;
|
||||
use transport::smtp::authentication::Mecanism;
|
||||
use transport::EmailTransport;
|
||||
|
||||
@@ -276,7 +276,7 @@ impl Response {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{Severity, Category, Response, ResponseParser, Code};
|
||||
use super::{Category, Code, Response, ResponseParser, Severity};
|
||||
|
||||
#[test]
|
||||
fn test_severity_from_str() {
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
//! succes
|
||||
|
||||
use transport::error::EmailResult;
|
||||
use transport::smtp::response::Response;
|
||||
use transport::smtp::response::{Category, Code, Response, Severity};
|
||||
use transport::EmailTransport;
|
||||
use transport::smtp::response::{Code, Category, Severity};
|
||||
use email::SendableEmail;
|
||||
|
||||
/// This transport does nothing exept logging the message enveloppe
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::io::Read;
|
||||
|
||||
use lettre::transport::file::FileEmailTransport;
|
||||
use lettre::transport::EmailTransport;
|
||||
use lettre::email::{SendableEmail, EmailBuilder};
|
||||
use lettre::email::{EmailBuilder, SendableEmail};
|
||||
|
||||
#[test]
|
||||
fn file_transport() {
|
||||
@@ -28,7 +28,10 @@ fn file_transport() {
|
||||
let mut buffer = String::new();
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user