Skip to content

Commit 2d3235f

Browse files
authored
Merge pull request #2 from robot-head/codex/fix-compilation-warnings
Fix compilation warnings
2 parents af995a4 + 7352eec commit 2d3235f

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

src/builtins/core/date.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,6 @@ impl PartialDate {
5454
*self == Self::default()
5555
}
5656

57-
pub(crate) fn try_from_year_month(year_month: &PlainYearMonth) -> TemporalResult<Self> {
58-
let (year, era, era_year) = if year_month.era().is_some() {
59-
(
60-
None,
61-
year_month
62-
.era()
63-
.map(|t| TinyAsciiStr::<19>::try_from_utf8(t.as_bytes()))
64-
.transpose()
65-
.map_err(|e| TemporalError::general(format!("{e}")))?,
66-
year_month.era_year(),
67-
)
68-
} else {
69-
(Some(year_month.year()), None, None)
70-
};
71-
Ok(Self {
72-
year,
73-
month: Some(year_month.month()),
74-
month_code: Some(year_month.month_code()),
75-
day: Some(1),
76-
era,
77-
era_year,
78-
calendar: year_month.calendar().clone(),
79-
})
80-
}
81-
82-
crate::impl_with_fallback_method!(with_fallback_year_month, () PlainYearMonth); // excludes day
8357
crate::impl_with_fallback_method!(with_fallback_date, (with_day: day) PlainDate);
8458
crate::impl_with_fallback_method!(with_fallback_datetime, (with_day:day) PlainDateTime);
8559
}

src/builtins/core/year_month.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ pub struct PartialYearMonth {
4242
}
4343

4444
impl PartialYearMonth {
45-
/// Returns a boolean for if the current `PartialYearMonth` is empty.
46-
pub(crate) fn is_empty(&self) -> bool {
47-
*self == Self::default()
48-
}
49-
5045
pub(crate) fn try_from_year_month(year_month: &PlainYearMonth) -> TemporalResult<Self> {
5146
let (year, era, era_year) = if year_month.era().is_some() {
5247
(

temporal_capi/src/calendar.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ pub mod ffi {
9999
partial: PartialDate,
100100
overflow: ArithmeticOverflow,
101101
) -> Result<Box<PlainYearMonth>, TemporalError> {
102+
let partial: temporal_rs::partial::PartialDate = partial.try_into()?;
102103
self.0
103-
.year_month_from_partial(&partial.try_into()?, overflow.into())
104+
.year_month_from_partial(&temporal_rs::partial::PartialYearMonth::from(&partial), overflow.into())
104105
.map(|c| Box::new(PlainYearMonth(c)))
105106
.map_err(Into::into)
106107
}

temporal_capi/src/plain_year_month.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ pub mod ffi {
4444
partial: PartialDate,
4545
overflow: Option<ArithmeticOverflow>,
4646
) -> Result<Box<Self>, TemporalError> {
47+
let partial: temporal_rs::partial::PartialDate = partial.try_into()?;
4748
self.0
48-
.with(partial.try_into()?, overflow.map(Into::into))
49+
.with(temporal_rs::partial::PartialYearMonth::from(&partial), overflow.map(Into::into))
4950
.map(|x| Box::new(Self(x)))
5051
.map_err(Into::into)
5152
}

0 commit comments

Comments
 (0)