Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 3, 2024
1 parent b805dde commit 7c76df5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions components/calendar/benches/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,13 @@ fn convert_benches(c: &mut Criterion) {
icu::calendar::gregorian::Gregorian,
);


#[cfg(feature = "bench")]
bench_calendar(
&mut group,
"calendar/hebrew",
icu::calendar::hebrew::Hebrew::new_always_calculating(),
);


#[cfg(feature = "bench")]
bench_calendar(
&mut group,
Expand Down
4 changes: 2 additions & 2 deletions components/calendar/src/hebrew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ impl Calendar for Hebrew {
day -= i64::from(month_len);
}
debug_assert!(false, "Attempted to get Hebrew date for {fixed_iso:?}, in year {h_year}, didn't have enough days in the year");
return HebrewDateInner(ArithmeticDate::new_unchecked_with_info(
HebrewDateInner(ArithmeticDate::new_unchecked_with_info(
h_year, 13, 29, year_info,
));
))
}

fn date_to_iso(&self, date: &Self::DateInner) -> Date<Iso> {
Expand Down
13 changes: 6 additions & 7 deletions utils/calendrical_calculations/src/hebrew_keviyah.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl YearInfo {
/// Returns the YearInfo and h_year for the year containing `date`
#[inline]
pub fn year_containing_rd(date: RataDie) -> (Self, i32) {
#[allow(unused_imports)]
use core_maths::*;
let days_since_epoch = (date - HEBREW_CALENDAR_EPOCH) as f64;
let maybe_approx =
Expand Down Expand Up @@ -383,13 +384,11 @@ impl Keviyah {
#[inline]
fn normalized_ordinal_month(self, ordinal_month: u8) -> Option<u8> {
if self.is_leap() {
if ordinal_month == 6 {
// Adar 1
None
} else if ordinal_month < 6 {
Some(ordinal_month)
} else {
Some(ordinal_month - 1)
match ordinal_month.cmp(&6) {
// Adar I
Ordering::Equal => None,
Ordering::Less => Some(ordinal_month),
Ordering::Greater => Some(ordinal_month - 1),
}
} else {
Some(ordinal_month)
Expand Down

0 comments on commit 7c76df5

Please sign in to comment.