Skip to content

Commit

Permalink
Fix edition 2018 idioms (#93)
Browse files Browse the repository at this point in the history
* Fix edition 2018 idioms
* Remove deprecated clippy plugin
  • Loading branch information
nickelc authored Sep 8, 2021
1 parent 562b3df commit 2882136
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 22 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -36,9 +32,6 @@
//! */
//! ```
#[cfg(test)]
extern crate chrono_tz;

pub mod error;
mod schedule;
mod time_unit;
Expand Down
6 changes: 3 additions & 3 deletions src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ impl Schedule {

/// Provides an iterator which will return each DateTime that matches the schedule starting with
/// the current time if applicable.
pub fn upcoming<Z>(&self, timezone: Z) -> ScheduleIterator<Z>
pub fn upcoming<Z>(&self, timezone: Z) -> ScheduleIterator<'_, Z>
where
Z: TimeZone,
{
self.after(&timezone.from_utc_datetime(&Utc::now().naive_utc()))
}

/// Like the `upcoming` method, but allows you to specify a start time other than the present.
pub fn after<Z>(&self, after: &DateTime<Z>) -> ScheduleIterator<Z>
pub fn after<Z>(&self, after: &DateTime<Z>) -> ScheduleIterator<'_, Z>
where
Z: TimeZone,
{
Expand Down Expand Up @@ -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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/time_unit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -140,7 +140,7 @@ pub trait TimeUnitSpec {
/// assert_eq!(Some(15), mid_month_paydays.next());
/// assert_eq!(None, mid_month_paydays.next());
/// ```
fn range<R>(&self, range: R) -> OrdinalRangeIter
fn range<R>(&self, range: R) -> OrdinalRangeIter<'_>
where
R: RangeBounds<Ordinal>;

Expand Down Expand Up @@ -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(),
}
Expand Down
4 changes: 0 additions & 4 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate chrono;
extern crate chrono_tz;
extern crate cron;

#[cfg(test)]
mod tests {
use chrono::*;
Expand Down

0 comments on commit 2882136

Please sign in to comment.