diff --git a/Cargo.toml b/Cargo.toml index adb39f6..3134e48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,4 @@ [package] - name = "imap" version = "1.0.2" authors = ["Matt McCoy ", @@ -10,6 +9,7 @@ homepage = "https://github.com/jonhoo/rust-imap" description = "IMAP client for Rust" readme = "README.md" license = "Apache-2.0/MIT" +edition = "2018" keywords = ["email", "imap"] categories = ["email", "network-programming"] @@ -21,10 +21,6 @@ maintenance = { status = "actively-developed" } is-it-maintained-issue-resolution = { repository = "jonhoo/rust-imap" } is-it-maintained-open-issues = { repository = "jonhoo/rust-imap" } -[lib] -name = "imap" -path = "src/lib.rs" - [dependencies] native-tls = "0.2.2" regex = "1.0" diff --git a/src/client.rs b/src/client.rs index 5aeb99b..9e0a02c 100644 --- a/src/client.rs +++ b/src/client.rs @@ -994,7 +994,7 @@ impl Session { /// command, as specified in the base IMAP specification. /// /// See [`extensions::idle::Handle`] for details. - pub fn idle(&mut self) -> Result> { + pub fn idle(&mut self) -> Result> { extensions::idle::Handle::make(self) } diff --git a/src/error.rs b/src/error.rs index ef89939..50ba919 100644 --- a/src/error.rs +++ b/src/error.rs @@ -77,7 +77,7 @@ impl<'a> From> for Error { } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Error::Io(ref e) => fmt::Display::fmt(e, f), Error::Tls(ref e) => fmt::Display::fmt(e, f), @@ -131,7 +131,7 @@ pub enum ParseError { } impl fmt::Display for ParseError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { ref e => f.write_str(e.description()), } @@ -162,7 +162,7 @@ impl StdError for ParseError { pub struct ValidateError(pub char); impl fmt::Display for ValidateError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // print character in debug form because invalid ones are often whitespaces write!(f, "{}: {:?}", self.description(), self.0) } diff --git a/src/extensions/idle.rs b/src/extensions/idle.rs index 32ea0a0..806a9b3 100644 --- a/src/extensions/idle.rs +++ b/src/extensions/idle.rs @@ -1,8 +1,8 @@ //! Adds support for the IMAP IDLE command specificed in [RFC //! 2177](https://tools.ietf.org/html/rfc2177). -use client::Session; -use error::{Error, Result}; +use crate::client::Session; +use crate::error::{Error, Result}; use native_tls::TlsStream; use std::io::{self, Read, Write}; use std::net::TcpStream; @@ -24,7 +24,7 @@ use std::time::Duration; /// /// As long as a [`Handle`] is active, the mailbox cannot be otherwise accessed. #[derive(Debug)] -pub struct Handle<'a, T: Read + Write + 'a> { +pub struct Handle<'a, T: Read + Write> { session: &'a mut Session, keepalive: Duration, done: bool, diff --git a/src/lib.rs b/src/lib.rs index 5dbece9..7c85baa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,26 +57,18 @@ //! Ok(Some(body)) //! } //! ``` - #![deny(missing_docs)] - -extern crate base64; -extern crate bufstream; -extern crate chrono; -extern crate imap_proto; -extern crate native_tls; -extern crate nom; -extern crate regex; +#![warn(rust_2018_idioms)] mod parse; pub mod types; mod authenticator; -pub use authenticator::Authenticator; +pub use crate::authenticator::Authenticator; mod client; -pub use client::*; +pub use crate::client::*; pub mod error; diff --git a/src/types/capabilities.rs b/src/types/capabilities.rs index 2cc3672..d6f4899 100644 --- a/src/types/capabilities.rs +++ b/src/types/capabilities.rs @@ -55,7 +55,7 @@ impl Capabilities { } /// Iterate over all the server's capabilities - pub fn iter(&self) -> Iter { + pub fn iter(&self) -> Iter<'_, Capability<'_>> { self.0.iter() } diff --git a/src/types/fetch.rs b/src/types/fetch.rs index 0b4cf54..8504557 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -33,7 +33,7 @@ pub struct Fetch { impl Fetch { /// A list of flags that are set for this message. - pub fn flags(&self) -> &[Flag] { + pub fn flags(&self) -> &[Flag<'_>] { &self.flags[..] } @@ -98,7 +98,7 @@ impl Fetch { /// /// The full description of the format of the envelope is given in [RFC 3501 section /// 7.4.2](https://tools.ietf.org/html/rfc3501#section-7.4.2). - pub fn envelope(&self) -> Option<&Envelope> { + pub fn envelope(&self) -> Option<&Envelope<'_>> { self.fetch .iter() .filter_map(|av| match av { diff --git a/src/types/mailbox.rs b/src/types/mailbox.rs index 500c12a..1b87720 100644 --- a/src/types/mailbox.rs +++ b/src/types/mailbox.rs @@ -52,7 +52,7 @@ impl Default for Mailbox { } impl fmt::Display for Mailbox { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "flags: {:?}, exists: {}, recent: {}, unseen: {:?}, permanent_flags: {:?},\ diff --git a/src/types/mod.rs b/src/types/mod.rs index 09fc44d..3facf7c 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -368,12 +368,12 @@ impl Hash for ZeroCopy { use std::fmt; impl fmt::Display for ZeroCopy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(&**self, f) } } impl fmt::Debug for ZeroCopy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&**self, f) } } diff --git a/src/types/name.rs b/src/types/name.rs index b80d3ef..88f31b7 100644 --- a/src/types/name.rs +++ b/src/types/name.rs @@ -68,7 +68,7 @@ impl<'a> From<&'a str> for NameAttribute<'a> { impl Name { /// Attributes of this name. - pub fn attributes(&self) -> &[NameAttribute] { + pub fn attributes(&self) -> &[NameAttribute<'_>] { &self.attributes[..] }