Skip to content

Commit bc7481c

Browse files
committed
Add PartialEq and PartialOrd, remove Ord and Eq
1 parent ce4229d commit bc7481c

File tree

5 files changed

+9
-33
lines changed

5 files changed

+9
-33
lines changed

Diff for: src/builtins/core/date.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ macro_rules! impl_with_fallback_method {
127127

128128
/// The native Rust implementation of `Temporal.PlainDate`.
129129
#[non_exhaustive]
130-
#[derive(Debug, Default, Clone, PartialEq, Eq)]
130+
#[derive(Debug, Default, Clone, PartialEq)]
131131
pub struct PlainDate {
132132
pub(crate) iso: IsoDate,
133133
calendar: Calendar,
@@ -139,15 +139,9 @@ impl core::fmt::Display for PlainDate {
139139
}
140140
}
141141

142-
impl Ord for PlainDate {
143-
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
144-
self.iso.cmp(&other.iso)
145-
}
146-
}
147-
148142
impl PartialOrd for PlainDate {
149143
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
150-
Some(self.cmp(other))
144+
Some(self.iso.cmp(&other.iso))
151145
}
152146
}
153147

Diff for: src/builtins/core/datetime.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct PartialDateTime {
3030

3131
/// The native Rust implementation of `Temporal.PlainDateTime`
3232
#[non_exhaustive]
33-
#[derive(Debug, Default, Clone, PartialEq, Eq)]
33+
#[derive(Debug, Default, Clone, PartialEq)]
3434
pub struct PlainDateTime {
3535
pub(crate) iso: IsoDateTime,
3636
calendar: Calendar,
@@ -45,15 +45,9 @@ impl core::fmt::Display for PlainDateTime {
4545
}
4646
}
4747

48-
impl Ord for PlainDateTime {
49-
fn cmp(&self, other: &Self) -> Ordering {
50-
self.iso.cmp(&other.iso)
51-
}
52-
}
53-
5448
impl PartialOrd for PlainDateTime {
5549
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
56-
Some(self.cmp(other))
50+
Some(self.iso.cmp(&other.iso))
5751
}
5852
}
5953

Diff for: src/builtins/core/month_day.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414

1515
/// The native Rust implementation of `Temporal.PlainMonthDay`
1616
#[non_exhaustive]
17-
#[derive(Debug, Default, Clone, PartialEq, Eq)]
17+
#[derive(Debug, Default, Clone, PartialEq)]
1818
pub struct PlainMonthDay {
1919
pub iso: IsoDate,
2020
calendar: Calendar,

Diff for: src/builtins/core/year_month.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::{Duration, PartialDate};
1717

1818
/// The native Rust implementation of `Temporal.YearMonth`.
1919
#[non_exhaustive]
20-
#[derive(Debug, Default, Clone, PartialEq, Eq)]
20+
#[derive(Debug, Default, Clone, PartialEq)]
2121
pub struct PlainYearMonth {
2222
pub(crate) iso: IsoDate,
2323
calendar: Calendar,
@@ -29,15 +29,9 @@ impl core::fmt::Display for PlainYearMonth {
2929
}
3030
}
3131

32-
impl Ord for PlainYearMonth {
33-
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
34-
self.iso.cmp(&other.iso)
35-
}
36-
}
37-
3832
impl PartialOrd for PlainYearMonth {
3933
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
40-
Some(self.cmp(other))
34+
Some(self.iso.cmp(&other.iso))
4135
}
4236
}
4337

Diff for: src/builtins/core/zoneddatetime.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,16 @@ pub struct PartialZonedDateTime {
4343

4444
/// The native Rust implementation of `Temporal.ZonedDateTime`.
4545
#[non_exhaustive]
46-
#[derive(Debug, Clone, PartialEq, Eq)]
46+
#[derive(Debug, Clone, PartialEq)]
4747
pub struct ZonedDateTime {
4848
instant: Instant,
4949
calendar: Calendar,
5050
tz: TimeZone,
5151
}
5252

53-
impl Ord for ZonedDateTime {
54-
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
55-
self.instant.cmp(&other.instant)
56-
}
57-
}
58-
5953
impl PartialOrd for ZonedDateTime {
6054
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
61-
Some(self.cmp(other))
55+
Some(self.instant.cmp(&other.instant))
6256
}
6357
}
6458

0 commit comments

Comments
 (0)