Skip to content

Commit 8e8187d

Browse files
committed
fix LangTag's Ord impl
1 parent 5441cf7 commit 8e8187d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

statement/src/_literal/_language_tag.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ impl std::cmp::PartialEq<LangTag<'_>> for &str {
7676
}
7777
}
7878

79+
impl std::cmp::Ord for LangTag<'_> {
80+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
81+
self.0
82+
.to_ascii_lowercase()
83+
.cmp(&other.0.to_ascii_lowercase())
84+
}
85+
}
86+
7987
impl std::cmp::PartialOrd for LangTag<'_> {
8088
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
81-
Some(
82-
self.0
83-
.to_ascii_lowercase()
84-
.cmp(&other.0.to_ascii_lowercase()),
85-
)
89+
Some(self.cmp(other))
8690
}
8791
}
8892

0 commit comments

Comments
 (0)