Skip to content

Commit

Permalink
Fix lints, CI failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Jan 19, 2025
1 parent b9651fb commit c866c3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ macro_rules! invalid_component {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn rfc_2822() -> time::Result<()> {
assert_eq!(
OffsetDateTime::parse("Sat, 02 Jan 2021 03:04:05 GMT", &Rfc2822)?,
Expand Down Expand Up @@ -664,6 +665,7 @@ fn iso_8601() {
}

#[test]
#[allow(clippy::cognitive_complexity)]
fn iso_8601_error() {
assert!(matches!(
OffsetDateTime::parse("20210102T03:04Z", &Iso8601::DEFAULT),
Expand Down
6 changes: 3 additions & 3 deletions time/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[cfg(feature = "formatting")]
use alloc::string::String;
use core::num::{NonZero, NonZeroI32};
use core::num::{NonZeroI32, NonZeroU8};
use core::ops::{Add, Sub};
use core::time::Duration as StdDuration;
use core::{cmp, fmt};
Expand Down Expand Up @@ -335,7 +335,7 @@ impl Date {
let month = ((ordinal - day_adj) * 10 + 300) / 306 + month_adj;
// Safety: `month` is guaranteed to be between 1 and 12 inclusive.
unsafe {
match Month::from_number(NonZero::new_unchecked(month as u8)) {
match Month::from_number(NonZeroU8::new_unchecked(month as u8)) {
Ok(month) => month,
Err(_) => core::hint::unreachable_unchecked(),
}
Expand Down Expand Up @@ -452,7 +452,7 @@ impl Date {
year,
// Safety: `month` is guaranteed to be between 1 and 12 inclusive.
unsafe {
match Month::from_number(NonZero::new_unchecked(month as u8)) {
match Month::from_number(NonZeroU8::new_unchecked(month as u8)) {
Ok(month) => month,
Err(_) => core::hint::unreachable_unchecked(),
}
Expand Down
1 change: 1 addition & 0 deletions time/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod parse_from_description;
#[cfg(feature = "parsing")]
mod try_from_parsed;

#[cfg(feature = "parsing")]
use core::convert::Infallible;
use core::fmt;

Expand Down

0 comments on commit c866c3c

Please sign in to comment.