Skip to content

Commit

Permalink
Hide &mut self methods from Deref in sidebar
Browse files Browse the repository at this point in the history
If there are no `DerefMut` impl for the type.
  • Loading branch information
nbdd0121 committed Jul 6, 2020
1 parent 0cd7ff7 commit e0b69f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4095,6 +4095,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
_ => None,
})
{
let deref_mut = v
.iter()
.filter(|i| i.inner_impl().trait_.is_some())
.any(|i| i.inner_impl().trait_.def_id() == c.deref_mut_trait_did);
let inner_impl = target
.def_id()
.or(target
Expand All @@ -4115,7 +4119,9 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
let mut ret = impls
.iter()
.filter(|i| i.inner_impl().trait_.is_none())
.flat_map(|i| get_methods(i.inner_impl(), true, &mut used_links, true))
.flat_map(|i| {
get_methods(i.inner_impl(), true, &mut used_links, deref_mut)
})
.collect::<Vec<_>>();
// We want links' order to be reproducible so we don't use unstable sort.
ret.sort();
Expand Down

0 comments on commit e0b69f2

Please sign in to comment.