diff --git a/src/client.rs b/src/client.rs index 8bb7e87..f93728c 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,7 +1,6 @@ use std::net::{TcpStream, ToSocketAddrs}; use openssl::ssl::{SslContext, SslStream}; -use std::io::{Read, Write}; -use std::io::{self}; +use std::io::{self, Read, Write}; use super::mailbox::Mailbox; use super::parse::{parse_response_ok, parse_capability, parse_select_or_examine}; diff --git a/src/error.rs b/src/error.rs index b03045c..361444c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ -use std::io::{self}; +use std::io::Error as IoError; use std::result; -use std::fmt::{self}; +use std::fmt; use std::error::Error as StdError; use openssl::ssl::error::SslError; @@ -10,14 +10,18 @@ pub type Result = result::Result; /// A set of errors that can occur in the IMAP client #[derive(Debug)] pub enum Error { - Io(io::Error), + /// An `io::Error` that occurred while trying to read or write to a network stream. + Io(IoError), + /// An error from the `openssl` library. Ssl(SslError), + /// A BAD response from the IMAP server. BadResponse(Vec), + /// A NO response from the IMAP server. NoResponse(Vec), } -impl From for Error { - fn from(err: io::Error) -> Error { +impl From for Error { + fn from(err: IoError) -> Error { Error::Io(err) } }