diff --git a/README.md b/README.md index 742be26..6bc5335 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ A cron expression parser. Works with stable Rust v1.28.0. ```rust -extern crate cron; -extern crate chrono; - use cron::Schedule; use chrono::Utc; use std::str::FromStr; diff --git a/src/error.rs b/src/error.rs index 0f86dec..be154fa 100644 --- a/src/error.rs +++ b/src/error.rs @@ -11,7 +11,7 @@ pub enum ErrorKind { } 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.kind { ErrorKind::Expression(ref expr) => write!(f, "Invalid expression: {}", expr), } diff --git a/src/lib.rs b/src/lib.rs index 1de0c27..e3d45b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,8 @@ -#![cfg_attr(feature = "clippy", feature(plugin))] -#![cfg_attr(feature = "clippy", plugin(clippy))] +#![deny(rust_2018_idioms)] //! A cron expression parser and schedule explorer //! # Example //! ``` -//! extern crate chrono; -//! extern crate cron; -//! //! use cron::Schedule; //! use chrono::Utc; //! use std::str::FromStr; @@ -36,9 +32,6 @@ //! */ //! ``` -#[cfg(test)] -extern crate chrono_tz; - pub mod error; mod schedule; mod time_unit; diff --git a/src/schedule.rs b/src/schedule.rs index 9943c14..25ea494 100644 --- a/src/schedule.rs +++ b/src/schedule.rs @@ -219,7 +219,7 @@ impl Schedule { /// Provides an iterator which will return each DateTime that matches the schedule starting with /// the current time if applicable. - pub fn upcoming(&self, timezone: Z) -> ScheduleIterator + pub fn upcoming(&self, timezone: Z) -> ScheduleIterator<'_, Z> where Z: TimeZone, { @@ -227,7 +227,7 @@ impl Schedule { } /// Like the `upcoming` method, but allows you to specify a start time other than the present. - pub fn after(&self, after: &DateTime) -> ScheduleIterator + pub fn after(&self, after: &DateTime) -> ScheduleIterator<'_, Z> where Z: TimeZone, { @@ -295,7 +295,7 @@ impl Schedule { } impl Display for Schedule { - fn fmt(&self, f: &mut Formatter) -> FmtResult { + fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "{}", self.source) } } diff --git a/src/time_unit/mod.rs b/src/time_unit/mod.rs index 9827f1e..6ebaef5 100644 --- a/src/time_unit/mod.rs +++ b/src/time_unit/mod.rs @@ -123,7 +123,7 @@ pub trait TimeUnitSpec { /// assert_eq!(Some(8), summer.next()); /// assert_eq!(None, summer.next()); /// ``` - fn iter(&self) -> OrdinalIter; + fn iter(&self) -> OrdinalIter<'_>; /// Provides an iterator which will return each included ordinal within the specified range. /// # Example @@ -140,7 +140,7 @@ pub trait TimeUnitSpec { /// assert_eq!(Some(15), mid_month_paydays.next()); /// assert_eq!(None, mid_month_paydays.next()); /// ``` - fn range(&self, range: R) -> OrdinalRangeIter + fn range(&self, range: R) -> OrdinalRangeIter<'_> where R: RangeBounds; @@ -179,7 +179,7 @@ where fn includes(&self, ordinal: Ordinal) -> bool { self.ordinals().contains(&ordinal) } - fn iter(&self) -> OrdinalIter { + fn iter(&self) -> OrdinalIter<'_> { OrdinalIter { set_iter: TimeUnitField::ordinals(self).iter(), } diff --git a/tests/lib.rs b/tests/lib.rs index 1f5243b..e4270df 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,7 +1,3 @@ -extern crate chrono; -extern crate chrono_tz; -extern crate cron; - #[cfg(test)] mod tests { use chrono::*;