Sort implementations alphabetically
For consistency and easier testing, we sort the implementation items alphabetically by their name and their definitions.
This commit is contained in:
parent
ae0a741d5a
commit
3c06846a30
@ -15,6 +15,7 @@ SPDX-License-Identifier: MIT
|
|||||||
- Show the definition for constants and typedefs.
|
- Show the definition for constants and typedefs.
|
||||||
- Fix group and ID for typdef items.
|
- Fix group and ID for typdef items.
|
||||||
- Extract the description of module items as HTML instead of plain text.
|
- Extract the description of module items as HTML instead of plain text.
|
||||||
|
- Sort implementations alphabetically.
|
||||||
|
|
||||||
## v0.1.2 (2020-07-25)
|
## v0.1.2 (2020-07-25)
|
||||||
|
|
||||||
|
@ -484,6 +484,8 @@ fn get_implementation_group(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impls.sort();
|
||||||
|
|
||||||
Ok(impls.into_member_group(Some(title.to_owned())))
|
Ok(impls.into_member_group(Some(title.to_owned())))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,6 +580,14 @@ impl<'a> MemberDocs<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn sort(&mut self) {
|
||||||
|
self.docs.sort_by(|d1, d2| {
|
||||||
|
d1.name
|
||||||
|
.cmp(&d2.name)
|
||||||
|
.then_with(|| d1.definition.cmp(&d2.definition))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn push(
|
pub fn push(
|
||||||
&mut self,
|
&mut self,
|
||||||
name: &mut Option<String>,
|
name: &mut Option<String>,
|
||||||
|
Loading…
Reference in New Issue
Block a user