Skip to content

Fix compilation warnings #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/builtins/core/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,6 @@ impl PartialDate {
*self == Self::default()
}

pub(crate) fn try_from_year_month(year_month: &PlainYearMonth) -> TemporalResult<Self> {
let (year, era, era_year) = if year_month.era().is_some() {
(
None,
year_month
.era()
.map(|t| TinyAsciiStr::<19>::try_from_utf8(t.as_bytes()))
.transpose()
.map_err(|e| TemporalError::general(format!("{e}")))?,
year_month.era_year(),
)
} else {
(Some(year_month.year()), None, None)
};
Ok(Self {
year,
month: Some(year_month.month()),
month_code: Some(year_month.month_code()),
day: Some(1),
era,
era_year,
calendar: year_month.calendar().clone(),
})
}

crate::impl_with_fallback_method!(with_fallback_year_month, () PlainYearMonth); // excludes day
crate::impl_with_fallback_method!(with_fallback_date, (with_day: day) PlainDate);
crate::impl_with_fallback_method!(with_fallback_datetime, (with_day:day) PlainDateTime);
}
Expand Down
5 changes: 0 additions & 5 deletions src/builtins/core/year_month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ pub struct PartialYearMonth {
}

impl PartialYearMonth {
/// Returns a boolean for if the current `PartialYearMonth` is empty.
pub(crate) fn is_empty(&self) -> bool {
*self == Self::default()
}

pub(crate) fn try_from_year_month(year_month: &PlainYearMonth) -> TemporalResult<Self> {
let (year, era, era_year) = if year_month.era().is_some() {
(
Expand Down
3 changes: 2 additions & 1 deletion temporal_capi/src/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ pub mod ffi {
partial: PartialDate,
overflow: ArithmeticOverflow,
) -> Result<Box<PlainYearMonth>, TemporalError> {
let partial: temporal_rs::partial::PartialDate = partial.try_into()?;
self.0
.year_month_from_partial(&partial.try_into()?, overflow.into())
.year_month_from_partial(&temporal_rs::partial::PartialYearMonth::from(&partial), overflow.into())
.map(|c| Box::new(PlainYearMonth(c)))
.map_err(Into::into)
}
Expand Down
3 changes: 2 additions & 1 deletion temporal_capi/src/plain_year_month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ pub mod ffi {
partial: PartialDate,
overflow: Option<ArithmeticOverflow>,
) -> Result<Box<Self>, TemporalError> {
let partial: temporal_rs::partial::PartialDate = partial.try_into()?;
self.0
.with(partial.try_into()?, overflow.map(Into::into))
.with(temporal_rs::partial::PartialYearMonth::from(&partial), overflow.map(Into::into))
.map(|x| Box::new(Self(x)))
.map_err(Into::into)
}
Expand Down