use serialize::json::{ToJson, Json, as_json};
use syntax::ast;
use syntax::edition::Edition;
-use syntax::feature_gate::UnstableFeatures;
use syntax::print::pprust;
use syntax::source_map::FileName;
use syntax::symbol::{Symbol, sym};
use rustc::hir;
use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::flock;
+use rustc_feature::UnstableFeatures;
use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy, Mutability};
use crate::config::RenderOptions;
themes.appendChild(but);
}});"#,
as_json(&themes));
- write(cx.dst.join(&format!("theme{}.js", cx.shared.resource_suffix)),
- theme_js.as_bytes()
- )?;
-
+ write_minify(&cx.shared.fs, cx.path("theme.js"),
+ &theme_js,
+ options.enable_minification)?;
write_minify(&cx.shared.fs, cx.path("main.js"),
static_files::MAIN_JS,
options.enable_minification)?;
v.push_str(&all_indexes.join("\n"));
// "addSearchOptions" has to be called first so the crate filtering can be set before the
// search might start (if it's set into the URL for example).
- v.push_str("addSearchOptions(searchIndex);initSearch(searchIndex);");
+ v.push_str("\naddSearchOptions(searchIndex);initSearch(searchIndex);");
cx.shared.fs.write(&dst, &v)?;
}
if options.enable_index_page {
fn render_impls(cx: &Context, w: &mut Buffer,
traits: &[&&Impl],
containing_item: &clean::Item) {
- for i in traits {
- let did = i.trait_did().unwrap();
- let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
- render_impl(w, cx, i, assoc_link,
- RenderMode::Normal, containing_item.stable_since(), true, None, false, true);
- }
+ let mut impls = traits.iter()
+ .map(|i| {
+ let did = i.trait_did().unwrap();
+ let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
+ let mut buffer = if w.is_for_html() {
+ Buffer::html()
+ } else {
+ Buffer::new()
+ };
+ render_impl(&mut buffer, cx, i, assoc_link,
+ RenderMode::Normal, containing_item.stable_since(),
+ true, None, false, true);
+ buffer.into_inner()
+ })
+ .collect::<Vec<_>>();
+ impls.sort();
+ w.write_str(&impls.join(""));
}
fn bounds(t_bounds: &[clean::GenericBound], trait_alias: bool) -> String {