diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs
index 64dbaf9083e7..3130815af0bd 100644
--- a/src/librustdoc/html/render/sidebar.rs
+++ b/src/librustdoc/html/render/sidebar.rs
@@ -79,7 +79,7 @@ impl<'a> LinkBlock<'a> {
}
/// A link to an item. Content should not be escaped.
-#[derive(Ord, PartialEq, Eq, Hash, Clone)]
+#[derive(PartialEq, Eq, Hash, Clone)]
pub(crate) struct Link<'a> {
/// The content for the anchor tag and title attr
name: Cow<'a, str>,
@@ -91,13 +91,13 @@ pub(crate) struct Link<'a> {
children: Vec>,
}
-impl PartialOrd for Link<'_> {
- fn partial_cmp(&self, other: &Link<'_>) -> Option {
+impl Ord for Link<'_> {
+ fn cmp(&self, other: &Self) -> Ordering {
match compare_names(&self.name, &other.name) {
- Ordering::Equal => (),
- result => return Some(result),
+ Ordering::Equal => {}
+ result => return result,
}
- (&self.name_html, &self.href, &self.children).partial_cmp(&(
+ (&self.name_html, &self.href, &self.children).cmp(&(
&other.name_html,
&other.href,
&other.children,
@@ -105,6 +105,12 @@ impl PartialOrd for Link<'_> {
}
}
+impl PartialOrd for Link<'_> {
+ fn partial_cmp(&self, other: &Self) -> Option {
+ Some(self.cmp(other))
+ }
+}
+
impl<'a> Link<'a> {
pub fn new(href: impl Into>, name: impl Into>) -> Self {
Self { href: href.into(), name: name.into(), children: vec![], name_html: None }