Resolve warnings in the IFC library
This commit is contained in:
parent
598e9a01f8
commit
d7a810c50b
|
@ -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" }
|
||||
|
|
|
@ -141,9 +141,7 @@ impl IFC {
|
|||
}
|
||||
|
||||
pub fn ymd(year: i32, month: u8, day: u8) -> Result<Self, Error> {
|
||||
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<chrono::NaiveDate> 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 {
|
||||
|
|
Loading…
Reference in New Issue