Skip to content

Commit

Permalink
Rollup merge of rust-lang#83826 - slightlyoutofphase:rustdoc-sidebar-…
Browse files Browse the repository at this point in the history
…order-shuffle, r=jyn514

List trait impls before deref methods in doc's sidebar

This PR is acting directly on a suggestion made by `````@jyn514````` in rust-lang#83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes rust-lang#83133.
  • Loading branch information
Dylan-DPC committed Apr 5, 2021
2 parents 9f240c1 + 72502e8 commit 14214df
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1915,13 +1915,6 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
}

if v.iter().any(|i| i.inner_impl().trait_.is_some()) {
if let Some(impl_) = v
.iter()
.filter(|i| i.inner_impl().trait_.is_some())
.find(|i| i.inner_impl().trait_.def_id_full(cache) == cx.cache.deref_trait_did)
{
sidebar_deref_methods(cx, out, impl_, v);
}
let format_impls = |impls: Vec<&Impl>| {
let mut links = FxHashSet::default();

Expand Down Expand Up @@ -1989,6 +1982,14 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
);
write_sidebar_links(out, blanket_format);
}

if let Some(impl_) = v
.iter()
.filter(|i| i.inner_impl().trait_.is_some())
.find(|i| i.inner_impl().trait_.def_id_full(cache) == cx.cache.deref_trait_did)
{
sidebar_deref_methods(cx, out, impl_, v);
}
}
}
}
Expand Down

0 comments on commit 14214df

Please sign in to comment.