diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 289b9673335..5b878c22e79 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1353,7 +1353,7 @@ fn item(&mut self, item: clean::Item, mut f: F) -> Result<(), Error> where // these modules are recursed into, but not rendered normally // (a flag on the context). if !self.render_redirect_pages { - self.render_redirect_pages = self.maybe_ignore_item(&item); + self.render_redirect_pages = maybe_ignore_item(&item); } if item.is_mod() { @@ -1436,7 +1436,7 @@ fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap BTreeMap bool { - match it.inner { - clean::StrippedItem(..) => true, - clean::ModuleItem(ref m) => { - it.doc_value().is_none() && m.items.is_empty() - && it.visibility != Some(clean::Public) - }, - _ => false, - } - } } impl<'a> Item<'a> { @@ -1706,7 +1695,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, if let clean::DefaultImplItem(..) = items[*i].inner { return false; } - !cx.maybe_ignore_item(&items[*i]) + !maybe_ignore_item(&items[*i]) }).collect::>(); // the order of item types in the listing @@ -1854,6 +1843,17 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering Ok(()) } +fn maybe_ignore_item(it: &clean::Item) -> bool { + match it.inner { + clean::StrippedItem(..) => true, + clean::ModuleItem(ref m) => { + it.doc_value().is_none() && m.items.is_empty() + && it.visibility != Some(clean::Public) + }, + _ => false, + } +} + fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec { let mut stability = vec![];