Skip to content

Commit 7dc4116

Browse files
committed
Migrate Context::maybe_ignore_item method to standalone function.
The method wasn't using any `self` data from Context, so it seemed miseading to implement it as a method.
1 parent 28ecfb6 commit 7dc4116

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/librustdoc/html/render.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ impl Context {
13531353
// these modules are recursed into, but not rendered normally
13541354
// (a flag on the context).
13551355
if !self.render_redirect_pages {
1356-
self.render_redirect_pages = self.maybe_ignore_item(&item);
1356+
self.render_redirect_pages = maybe_ignore_item(&item);
13571357
}
13581358

13591359
if item.is_mod() {
@@ -1436,7 +1436,7 @@ impl Context {
14361436
// BTreeMap instead of HashMap to get a sorted output
14371437
let mut map = BTreeMap::new();
14381438
for item in &m.items {
1439-
if self.maybe_ignore_item(item) { continue }
1439+
if maybe_ignore_item(item) { continue }
14401440

14411441
let short = item_type(item).css_class();
14421442
let myname = match item.name {
@@ -1453,17 +1453,6 @@ impl Context {
14531453
}
14541454
return map;
14551455
}
1456-
1457-
fn maybe_ignore_item(&self, it: &clean::Item) -> bool {
1458-
match it.inner {
1459-
clean::StrippedItem(..) => true,
1460-
clean::ModuleItem(ref m) => {
1461-
it.doc_value().is_none() && m.items.is_empty()
1462-
&& it.visibility != Some(clean::Public)
1463-
},
1464-
_ => false,
1465-
}
1466-
}
14671456
}
14681457

14691458
impl<'a> Item<'a> {
@@ -1706,7 +1695,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17061695
if let clean::DefaultImplItem(..) = items[*i].inner {
17071696
return false;
17081697
}
1709-
!cx.maybe_ignore_item(&items[*i])
1698+
!maybe_ignore_item(&items[*i])
17101699
}).collect::<Vec<usize>>();
17111700

17121701
// the order of item types in the listing
@@ -1854,6 +1843,17 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
18541843
Ok(())
18551844
}
18561845

1846+
fn maybe_ignore_item(it: &clean::Item) -> bool {
1847+
match it.inner {
1848+
clean::StrippedItem(..) => true,
1849+
clean::ModuleItem(ref m) => {
1850+
it.doc_value().is_none() && m.items.is_empty()
1851+
&& it.visibility != Some(clean::Public)
1852+
},
1853+
_ => false,
1854+
}
1855+
}
1856+
18571857
fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec<String> {
18581858
let mut stability = vec![];
18591859

0 commit comments

Comments
 (0)