Skip to content

Commit

Permalink
Migrate Context::maybe_ignore_item method to standalone function.
Browse files Browse the repository at this point in the history
The method wasn't using any `self` data from Context, so it seemed
miseading to implement it as a method.
  • Loading branch information
frewsxcv committed Aug 25, 2016
1 parent 28ecfb6 commit 7dc4116
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/librustdoc/html/render.rs
Expand Up @@ -1353,7 +1353,7 @@ impl Context {
// 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() {
Expand Down Expand Up @@ -1436,7 +1436,7 @@ impl Context {
// BTreeMap instead of HashMap to get a sorted output
let mut map = BTreeMap::new();
for item in &m.items {
if self.maybe_ignore_item(item) { continue }
if maybe_ignore_item(item) { continue }

let short = item_type(item).css_class();
let myname = match item.name {
Expand All @@ -1453,17 +1453,6 @@ impl Context {
}
return map;
}

fn maybe_ignore_item(&self, 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,
}
}
}

impl<'a> Item<'a> {
Expand Down Expand Up @@ -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::<Vec<usize>>();

// the order of item types in the listing
Expand Down Expand Up @@ -1854,6 +1843,17 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
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<String> {
let mut stability = vec![];

Expand Down

0 comments on commit 7dc4116

Please sign in to comment.