@@ -79,7 +79,7 @@ impl<'a> LinkBlock<'a> {
7979}
8080
8181/// A link to an item. Content should not be escaped.
82- #[ derive( Ord , PartialEq , Eq , Hash , Clone ) ]
82+ #[ derive( PartialEq , Eq , Hash , Clone ) ]
8383pub ( crate ) struct Link < ' a > {
8484 /// The content for the anchor tag and title attr
8585 name : Cow < ' a , str > ,
@@ -91,20 +91,26 @@ pub(crate) struct Link<'a> {
9191 children : Vec < Link < ' a > > ,
9292}
9393
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 {
9696 match compare_names ( & self . name , & other. name ) {
97- Ordering :: Equal => ( ) ,
98- result => return Some ( result) ,
97+ Ordering :: Equal => { }
98+ result => return result,
9999 }
100- ( & self . name_html , & self . href , & self . children ) . partial_cmp ( & (
100+ ( & self . name_html , & self . href , & self . children ) . cmp ( & (
101101 & other. name_html ,
102102 & other. href ,
103103 & other. children ,
104104 ) )
105105 }
106106}
107107
108+ impl PartialOrd for Link < ' _ > {
109+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
110+ Some ( self . cmp ( other) )
111+ }
112+ }
113+
108114impl < ' a > Link < ' a > {
109115 pub fn new ( href : impl Into < Cow < ' a , str > > , name : impl Into < Cow < ' a , str > > ) -> Self {
110116 Self { href : href. into ( ) , name : name. into ( ) , children : vec ! [ ] , name_html : None }
0 commit comments