Move to 2018 edition

This commit is contained in:
Jon Gjengset 2019-09-03 09:35:15 -04:00
parent 31e2490d22
commit 2aa8c87e35
No known key found for this signature in database
GPG key ID: FAEA8B761ADA5F4C
10 changed files with 18 additions and 30 deletions

View file

@ -1,5 +1,4 @@
[package] [package]
name = "imap" name = "imap"
version = "1.0.2" version = "1.0.2"
authors = ["Matt McCoy <mattnenterprise@yahoo.com>", authors = ["Matt McCoy <mattnenterprise@yahoo.com>",
@ -10,6 +9,7 @@ homepage = "https://github.com/jonhoo/rust-imap"
description = "IMAP client for Rust" description = "IMAP client for Rust"
readme = "README.md" readme = "README.md"
license = "Apache-2.0/MIT" license = "Apache-2.0/MIT"
edition = "2018"
keywords = ["email", "imap"] keywords = ["email", "imap"]
categories = ["email", "network-programming"] categories = ["email", "network-programming"]
@ -21,10 +21,6 @@ maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "jonhoo/rust-imap" } is-it-maintained-issue-resolution = { repository = "jonhoo/rust-imap" }
is-it-maintained-open-issues = { repository = "jonhoo/rust-imap" } is-it-maintained-open-issues = { repository = "jonhoo/rust-imap" }
[lib]
name = "imap"
path = "src/lib.rs"
[dependencies] [dependencies]
native-tls = "0.2.2" native-tls = "0.2.2"
regex = "1.0" regex = "1.0"

View file

@ -994,7 +994,7 @@ impl<T: Read + Write> Session<T> {
/// command, as specified in the base IMAP specification. /// command, as specified in the base IMAP specification.
/// ///
/// See [`extensions::idle::Handle`] for details. /// See [`extensions::idle::Handle`] for details.
pub fn idle(&mut self) -> Result<extensions::idle::Handle<T>> { pub fn idle(&mut self) -> Result<extensions::idle::Handle<'_, T>> {
extensions::idle::Handle::make(self) extensions::idle::Handle::make(self)
} }

View file

@ -77,7 +77,7 @@ impl<'a> From<Response<'a>> for Error {
} }
impl fmt::Display 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 { match *self {
Error::Io(ref e) => fmt::Display::fmt(e, f), Error::Io(ref e) => fmt::Display::fmt(e, f),
Error::Tls(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 { 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 { match *self {
ref e => f.write_str(e.description()), ref e => f.write_str(e.description()),
} }
@ -162,7 +162,7 @@ impl StdError for ParseError {
pub struct ValidateError(pub char); pub struct ValidateError(pub char);
impl fmt::Display for ValidateError { 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 // print character in debug form because invalid ones are often whitespaces
write!(f, "{}: {:?}", self.description(), self.0) write!(f, "{}: {:?}", self.description(), self.0)
} }

View file

@ -1,8 +1,8 @@
//! Adds support for the IMAP IDLE command specificed in [RFC //! Adds support for the IMAP IDLE command specificed in [RFC
//! 2177](https://tools.ietf.org/html/rfc2177). //! 2177](https://tools.ietf.org/html/rfc2177).
use client::Session; use crate::client::Session;
use error::{Error, Result}; use crate::error::{Error, Result};
use native_tls::TlsStream; use native_tls::TlsStream;
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
use std::net::TcpStream; 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. /// As long as a [`Handle`] is active, the mailbox cannot be otherwise accessed.
#[derive(Debug)] #[derive(Debug)]
pub struct Handle<'a, T: Read + Write + 'a> { pub struct Handle<'a, T: Read + Write> {
session: &'a mut Session<T>, session: &'a mut Session<T>,
keepalive: Duration, keepalive: Duration,
done: bool, done: bool,

View file

@ -57,26 +57,18 @@
//! Ok(Some(body)) //! Ok(Some(body))
//! } //! }
//! ``` //! ```
#![deny(missing_docs)] #![deny(missing_docs)]
#![warn(rust_2018_idioms)]
extern crate base64;
extern crate bufstream;
extern crate chrono;
extern crate imap_proto;
extern crate native_tls;
extern crate nom;
extern crate regex;
mod parse; mod parse;
pub mod types; pub mod types;
mod authenticator; mod authenticator;
pub use authenticator::Authenticator; pub use crate::authenticator::Authenticator;
mod client; mod client;
pub use client::*; pub use crate::client::*;
pub mod error; pub mod error;

View file

@ -55,7 +55,7 @@ impl Capabilities {
} }
/// Iterate over all the server's capabilities /// Iterate over all the server's capabilities
pub fn iter(&self) -> Iter<Capability> { pub fn iter(&self) -> Iter<'_, Capability<'_>> {
self.0.iter() self.0.iter()
} }

View file

@ -33,7 +33,7 @@ pub struct Fetch {
impl Fetch { impl Fetch {
/// A list of flags that are set for this message. /// A list of flags that are set for this message.
pub fn flags(&self) -> &[Flag] { pub fn flags(&self) -> &[Flag<'_>] {
&self.flags[..] &self.flags[..]
} }
@ -98,7 +98,7 @@ impl Fetch {
/// ///
/// The full description of the format of the envelope is given in [RFC 3501 section /// 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). /// 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 self.fetch
.iter() .iter()
.filter_map(|av| match av { .filter_map(|av| match av {

View file

@ -52,7 +52,7 @@ impl Default for Mailbox {
} }
impl fmt::Display 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!( write!(
f, f,
"flags: {:?}, exists: {}, recent: {}, unseen: {:?}, permanent_flags: {:?},\ "flags: {:?}, exists: {}, recent: {}, unseen: {:?}, permanent_flags: {:?},\

View file

@ -368,12 +368,12 @@ impl<D: Hash> Hash for ZeroCopy<D> {
use std::fmt; use std::fmt;
impl<D: fmt::Display> fmt::Display for ZeroCopy<D> { impl<D: fmt::Display> fmt::Display for ZeroCopy<D> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&**self, f) fmt::Display::fmt(&**self, f)
} }
} }
impl<D: fmt::Debug> fmt::Debug for ZeroCopy<D> { impl<D: fmt::Debug> fmt::Debug for ZeroCopy<D> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f) fmt::Debug::fmt(&**self, f)
} }
} }

View file

@ -68,7 +68,7 @@ impl<'a> From<&'a str> for NameAttribute<'a> {
impl Name { impl Name {
/// Attributes of this name. /// Attributes of this name.
pub fn attributes(&self) -> &[NameAttribute] { pub fn attributes(&self) -> &[NameAttribute<'_>] {
&self.attributes[..] &self.attributes[..]
} }