Skip to content

Commit

Permalink
Switch test to TryFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed May 26, 2023
1 parent a8f177e commit 817e849
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/naive/internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ const fn weekday_from_u32_mod7(n: u32) -> Weekday {
#[cfg(test)]
mod tests {
use num_iter::range_inclusive;
use num_traits::FromPrimitive;
use std::convert::TryFrom;
use std::u32;

use super::weekday_from_u32_mod7;
Expand Down Expand Up @@ -888,7 +888,7 @@ mod tests {
#[test]
fn test_weekday_from_u32_mod7() {
for i in 0..=1000 {
assert_eq!(weekday_from_u32_mod7(i), Weekday::from_u32(i % 7).unwrap());
assert_eq!(weekday_from_u32_mod7(i), Weekday::try_from((i % 7) as u8).unwrap());
}
assert_eq!(weekday_from_u32_mod7(u32::MAX), Weekday::Thu);
}
Expand Down

0 comments on commit 817e849

Please sign in to comment.