From d7a810c50b094e2e411c5d7eea22f7d1eb33bfc5 Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Wed, 4 Oct 2023 16:30:50 -0400 Subject: [PATCH] Resolve warnings in the IFC library --- ifc/Cargo.toml | 1 - ifc/src/lib.rs | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ifc/Cargo.toml b/ifc/Cargo.toml index 0da100b..30cd94d 100644 --- a/ifc/Cargo.toml +++ b/ifc/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" keywords = ["date", "time", "calendar"] categories = ["date-and-time"] license = "GPL-3.0-only" -license-file = "../COPYING" [dependencies] chrono = { version = "0.4" } diff --git a/ifc/src/lib.rs b/ifc/src/lib.rs index 5ede0c0..83b5719 100644 --- a/ifc/src/lib.rs +++ b/ifc/src/lib.rs @@ -141,9 +141,7 @@ impl IFC { } pub fn ymd(year: i32, month: u8, day: u8) -> Result { - if month < 1 || month > 13 { - Err(Error::InvalidDate) - } else if day < 1 || day > 28 { + if !(1..=13).contains(&month) || !(1..=28).contains(&day) { Err(Error::InvalidDate) } else { Ok(Self::Day(Day { year, month, day })) @@ -248,12 +246,12 @@ impl From for IFC { if is_leap_year(date.year()) && date > NaiveDate::from_ymd_opt(date.year(), 6, 17).unwrap() { - days = days - 1; + days -= 1; } let mut month: u8 = (days / 28).try_into().unwrap(); let mut day: u8 = (days % 28).try_into().unwrap(); if day == 0 { - month = month - 1; + month -= 1; day = 28; } Self::Day(Day {