From 1068855925581d7f6d4a177c5f55ac3d5da8afd7 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Thu, 4 Dec 2014 00:51:19 +0900 Subject: [PATCH] rustdoc: Avoid rendering foreign items to the sidebar. Otherwise the generated documentation is 30% larger. The sidebar renders an entry for each item to all items, so large modules have O(n^2) items rendered in the sidebars. Not a correct solution, but at least it works. --- src/librustdoc/html/render.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 36ce2796faf0..9eee8e04f0c2 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1244,6 +1244,10 @@ impl Context { for item in m.items.iter() { if self.ignore_private_item(item) { continue } + // avoid putting foreign items to the sidebar. + if let &clean::ForeignFunctionItem(..) = &item.inner { continue } + if let &clean::ForeignStaticItem(..) = &item.inner { continue } + let short = shortty(item).to_static_str(); let myname = match item.name { None => continue,