From 9272272c24a5a2f5c5ab315eeeebbeb903ee8a47 Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Wed, 5 Nov 2014 02:39:32 +0100 Subject: [PATCH] Code cleanup --- README.md | 7 +++---- src/client/stream.rs | 9 +++++++++ src/command.rs | 9 +++++---- src/response.rs | 3 ++- src/transaction.rs | 1 + tests/lib.rs | 9 +++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a51d9db..409a41a 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,10 @@ This library is designed for Rust 0.13.0-nightly (master). Install ------- -If you're using `Cargo`, just add this to your `Cargo.toml`: +If you're using the library in a program, just add this to your `Cargo.toml`: ```toml [dependencies.smtp] - git = "https://github.com/amousset/rust-smtp.git" ``` @@ -33,12 +32,12 @@ INFO:smtp::client: from=, size=989, nrcpt=1 INFO:smtp::client: to=, status=sent (250 2.0.0 Ok: queued as 9D28F1C0A51) ``` -Run `./target/examples/client -h` to get a list of options. +Run `./target/examples/client -h` to get a list of available options. Documentation ------------- -The documentation is available on [GitHub pages](http://amousset.github.io/rust-smtp/smtp/). +You can build the documentation with `cargo doc`. It is also available on [GitHub pages](http://amousset.github.io/rust-smtp/smtp/). License ------- diff --git a/src/client/stream.rs b/src/client/stream.rs index 2f58fb1..3bf9bf0 100644 --- a/src/client/stream.rs +++ b/src/client/stream.rs @@ -1,3 +1,12 @@ +// Copyright 2014 Alexis Mousset. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + //! TODO use std::io::net::tcp::TcpStream; diff --git a/src/command.rs b/src/command.rs index 1bcbc8f..dbed7d6 100644 --- a/src/command.rs +++ b/src/command.rs @@ -12,6 +12,7 @@ #![unstable] use std::fmt::{Show, Formatter, Result}; + use common::SP; /// Supported SMTP commands @@ -110,20 +111,20 @@ mod test { fn test_fmt() { assert_eq!( format!("{}", super::Noop), - format!("NOOP") + "NOOP".to_string() ); assert_eq!( format!("{}", super::ExtendedHello("my_name".to_string())), - format!("EHLO my_name") + "EHLO my_name".to_string() ); assert_eq!( format!("{}", super::Mail("test".to_string(), Some(vec!("option".to_string())))), - format!("MAIL FROM: option") + "MAIL FROM: option".to_string() ); assert_eq!( format!("{}", super::Mail("test".to_string(), Some(vec!("option".to_string(), "option2".to_string())))), - format!("MAIL FROM: option option2") + "MAIL FROM: option option2".to_string() ); } diff --git a/src/response.rs b/src/response.rs index d52d672..84cb918 100644 --- a/src/response.rs +++ b/src/response.rs @@ -13,9 +13,10 @@ use std::from_str::FromStr; use std::fmt::{Show, Formatter, Result}; -use common::remove_trailing_crlf; use std::result; +use common::remove_trailing_crlf; + /// Contains an SMTP reply, with separed code and message /// /// We do accept messages containing only a code, to comply with RFC5321 diff --git a/src/transaction.rs b/src/transaction.rs index df8e1f5..c76e944 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -13,6 +13,7 @@ use std::fmt; use std::fmt::{Show, Formatter}; + use command; use command::Command; diff --git a/tests/lib.rs b/tests/lib.rs index 0455e50..ed8c87e 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,3 +1,12 @@ +// Copyright 2014 Alexis Mousset. See the COPYRIGHT +// file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[test] fn foo() {