Apply strict linting to release builds #75

Merged
savanni merged 21 commits from clippy-linting into main 2023-10-05 17:01:49 +00:00
2 changed files with 3 additions and 6 deletions
Showing only changes of commit 49b1865818 - Show all commits

View File

@ -7,7 +7,6 @@ edition = "2018"
keywords = ["date", "time", "calendar"] keywords = ["date", "time", "calendar"]
categories = ["date-and-time"] categories = ["date-and-time"]
license = "GPL-3.0-only" license = "GPL-3.0-only"
license-file = "../COPYING"
[dependencies] [dependencies]
chrono = { version = "0.4" } chrono = { version = "0.4" }

View File

@ -141,9 +141,7 @@ impl IFC {
} }
pub fn ymd(year: i32, month: u8, day: u8) -> Result<Self, Error> { pub fn ymd(year: i32, month: u8, day: u8) -> Result<Self, Error> {
if month < 1 || month > 13 { if !(1..=13).contains(&month) || !(1..=28).contains(&day) {
Err(Error::InvalidDate)
} else if day < 1 || day > 28 {
Err(Error::InvalidDate) Err(Error::InvalidDate)
} else { } else {
Ok(Self::Day(Day { year, month, day })) Ok(Self::Day(Day { year, month, day }))
@ -248,12 +246,12 @@ impl From<chrono::NaiveDate> for IFC {
if is_leap_year(date.year()) if is_leap_year(date.year())
&& date > NaiveDate::from_ymd_opt(date.year(), 6, 17).unwrap() && 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 month: u8 = (days / 28).try_into().unwrap();
let mut day: u8 = (days % 28).try_into().unwrap(); let mut day: u8 = (days % 28).try_into().unwrap();
if day == 0 { if day == 0 {
month = month - 1; month -= 1;
day = 28; day = 28;
} }
Self::Day(Day { Self::Day(Day {