Skip to content

Commit d22c18b

Browse files
authored
Rollup merge of #71945 - GuillaumeGomez:sort-impl-on-foreign-types-section, r=kinnison,ollie27
Sort "implementations on foreign types" section in the sidebar Fixes #71926. We were sorting by the ID instead of sorting by the name. They're not in the same order as the implementations but I think it makes more sense this way considering this is what we do for the methods as well. r? @kinnison cc @rust-lang/rustdoc
2 parents 37a9192 + b865db0 commit d22c18b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/librustdoc/html/render.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -4344,20 +4344,19 @@ fn sidebar_trait(buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) {
43444344
let mut res = implementors
43454345
.iter()
43464346
.filter(|i| i.inner_impl().for_.def_id().map_or(false, |d| !c.paths.contains_key(&d)))
4347-
.filter_map(|i| match extract_for_impl_name(&i.impl_item) {
4348-
Some((ref name, ref id)) => {
4349-
Some(format!("<a href=\"#{}\">{}</a>", id, Escape(name)))
4350-
}
4351-
_ => None,
4352-
})
4353-
.collect::<Vec<String>>();
4347+
.filter_map(|i| extract_for_impl_name(&i.impl_item))
4348+
.collect::<Vec<_>>();
4349+
43544350
if !res.is_empty() {
43554351
res.sort();
43564352
sidebar.push_str(&format!(
43574353
"<a class=\"sidebar-title\" href=\"#foreign-impls\">\
43584354
Implementations on Foreign Types</a><div \
43594355
class=\"sidebar-links\">{}</div>",
4360-
res.join("")
4356+
res.into_iter()
4357+
.map(|(name, id)| format!("<a href=\"#{}\">{}</a>", id, Escape(&name)))
4358+
.collect::<Vec<_>>()
4359+
.join("")
43614360
));
43624361
}
43634362
}

0 commit comments

Comments
 (0)