Skip to content

Commit

Permalink
Apply clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Aug 12, 2022
1 parent 7c276e4 commit 489debb
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/format/parsed.rs
Expand Up @@ -22,7 +22,7 @@ use crate::{Datelike, Timelike};
///
/// - `to_*` methods try to make a concrete date and time value out of set fields.
/// It fully checks any remaining out-of-range conditions and inconsistent/impossible fields.
#[derive(Clone, PartialEq, Debug, Default)]
#[derive(Clone, PartialEq, Eq, Debug, Default)]
pub struct Parsed {
/// Year.
///
Expand Down
2 changes: 1 addition & 1 deletion src/month.rs
Expand Up @@ -201,7 +201,7 @@ impl Months {
}

/// An error resulting from reading `<Month>` value with `FromStr`.
#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Eq)]
pub struct ParseMonthError {
pub(crate) _dummy: (),
}
Expand Down
2 changes: 1 addition & 1 deletion src/naive/date.rs
Expand Up @@ -207,7 +207,7 @@ fn test_date_bounds() {
impl NaiveDate {
/// Makes a new `NaiveDate` from year and packed ordinal-flags, with a verification.
fn from_of(year: i32, of: Of) -> Option<NaiveDate> {
if year >= MIN_YEAR && year <= MAX_YEAR && of.valid() {
if (MIN_YEAR..=MAX_YEAR).contains(&year) && of.valid() {
let Of(of) = of;
Some(NaiveDate { ymdf: (year << 13) | (of as DateImpl) })
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/naive/time/mod.rs
Expand Up @@ -536,7 +536,6 @@ impl NaiveTime {
/// assert_eq!(from_hms(3, 4, 5).overflowing_add_signed(Duration::hours(-7)),
/// (from_hms(20, 4, 5), -86_400));
/// ```
#[cfg_attr(feature = "cargo-clippy", allow(cyclomatic_complexity))]
pub fn overflowing_add_signed(&self, mut rhs: OldDuration) -> (NaiveTime, i64) {
let mut secs = self.secs;
let mut frac = self.frac;
Expand Down Expand Up @@ -585,7 +584,7 @@ impl NaiveTime {
frac -= 1_000_000_000;
secs += 1;
}
debug_assert!(-86_400 <= secs && secs < 2 * 86_400);
debug_assert!((-86_400..2 * 86_400).contains(&secs));
debug_assert!((0..1_000_000_000).contains(&frac));

if secs < 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/offset/local/tz_info/parser.rs
Expand Up @@ -229,7 +229,7 @@ impl<'a> Cursor<'a> {
}

pub(crate) fn peek(&self) -> Option<&u8> {
self.remaining().get(0)
self.remaining().first()
}

/// Returns remaining data
Expand Down
2 changes: 1 addition & 1 deletion src/offset/local/tz_info/rule.rs
Expand Up @@ -399,7 +399,7 @@ fn parse_rule_time(cursor: &mut Cursor) -> Result<i32, Error> {
fn parse_rule_time_extended(cursor: &mut Cursor) -> Result<i32, Error> {
let (sign, hour, minute, second) = parse_signed_hhmmss(cursor)?;

if hour < -167 || hour > 167 {
if !(-167..=167).contains(&hour) {
return Err(Error::InvalidTzString("invalid day time hour"));
}
if !(0..=59).contains(&minute) {
Expand Down
2 changes: 1 addition & 1 deletion src/weekday.rs
Expand Up @@ -186,7 +186,7 @@ impl num_traits::FromPrimitive for Weekday {
}

/// An error resulting from reading `Weekday` value with `FromStr`.
#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Eq)]
pub struct ParseWeekdayError {
pub(crate) _dummy: (),
}
Expand Down

0 comments on commit 489debb

Please sign in to comment.