@@ -79,7 +79,7 @@ impl<'a> LinkBlock<'a> {
79
79
}
80
80
81
81
/// A link to an item. Content should not be escaped.
82
- #[ derive( Ord , PartialEq , Eq , Hash , Clone ) ]
82
+ #[ derive( PartialEq , Eq , Hash , Clone ) ]
83
83
pub ( crate ) struct Link < ' a > {
84
84
/// The content for the anchor tag and title attr
85
85
name : Cow < ' a , str > ,
@@ -91,20 +91,26 @@ pub(crate) struct Link<'a> {
91
91
children : Vec < Link < ' a > > ,
92
92
}
93
93
94
- impl PartialOrd for Link < ' _ > {
95
- fn partial_cmp ( & self , other : & Link < ' _ > ) -> Option < Ordering > {
94
+ impl Ord for Link < ' _ > {
95
+ fn cmp ( & self , other : & Self ) -> Ordering {
96
96
match compare_names ( & self . name , & other. name ) {
97
- Ordering :: Equal => ( ) ,
98
- result => return Some ( result) ,
97
+ Ordering :: Equal => { }
98
+ result => return result,
99
99
}
100
- ( & self . name_html , & self . href , & self . children ) . partial_cmp ( & (
100
+ ( & self . name_html , & self . href , & self . children ) . cmp ( & (
101
101
& other. name_html ,
102
102
& other. href ,
103
103
& other. children ,
104
104
) )
105
105
}
106
106
}
107
107
108
+ impl PartialOrd for Link < ' _ > {
109
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
110
+ Some ( self . cmp ( other) )
111
+ }
112
+ }
113
+
108
114
impl < ' a > Link < ' a > {
109
115
pub fn new ( href : impl Into < Cow < ' a , str > > , name : impl Into < Cow < ' a , str > > ) -> Self {
110
116
Self { href : href. into ( ) , name : name. into ( ) , children : vec ! [ ] , name_html : None }
0 commit comments