Skip to content

Commit

Permalink
Sort "implementations on foreign types" section in the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 9, 2020
1 parent 97f3eee commit b865db0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4344,20 +4344,19 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
let mut res = implementors
.iter()
.filter(|i| i.inner_impl().for_.def_id().map_or(false, |d| !c.paths.contains_key(&d)))
.filter_map(|i| match extract_for_impl_name(&i.impl_item) {
Some((ref name, ref id)) => {
Some(format!("<a href=\"#{}\">{}</a>", id, Escape(name)))
}
_ => None,
})
.collect::<Vec<String>>();
.filter_map(|i| extract_for_impl_name(&i.impl_item))
.collect::<Vec<_>>();

if !res.is_empty() {
res.sort();
sidebar.push_str(&format!(
"<a class=\"sidebar-title\" href=\"#foreign-impls\">\
Implementations on Foreign Types</a><div \
class=\"sidebar-links\">{}</div>",
res.join("")
res.into_iter()
.map(|(name, id)| format!("<a href=\"#{}\">{}</a>", id, Escape(&name)))
.collect::<Vec<_>>()
.join("")
));
}
}
Expand Down

0 comments on commit b865db0

Please sign in to comment.