about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Crichton <wcrichto@cs.stanford.edu>2021-10-01 13:57:57 -0700
committerWill Crichton <wcrichto@cs.stanford.edu>2021-10-06 19:45:26 -0700
commit55731bbc7dcf8f9a5ecbaca70366206e7c66c1f5 (patch)
tree0bc1f7816f24a942e70b2760227f5ac3951f540c
parent25323ec306b99adf6b5751c6f0a96eb373857336 (diff)
downloadrust-55731bbc7dcf8f9a5ecbaca70366206e7c66c1f5.tar.gz
rust-55731bbc7dcf8f9a5ecbaca70366206e7c66c1f5.zip
Fix lint error, change scrape-examples.js minify call
-rw-r--r--src/librustdoc/html/render/context.rs2
-rw-r--r--src/librustdoc/html/render/write_shared.rs7
-rw-r--r--src/librustdoc/html/static/js/scrape-examples.js2
3 files changed, 9 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 5dde228c5b9..364be8ae756 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -417,7 +417,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
             krate: krate.name.to_string(),
             css_file_extension: extension_css,
             generate_search_filter,
-            scrape_examples_extension: call_locations.len() > 0,
+            scrape_examples_extension: !call_locations.is_empty(),
         };
         let mut issue_tracker_base_url = None;
         let mut include_sources = true;
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index 4aa4936240a..5f761f9e9de 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -304,7 +304,12 @@ pub(super) fn write_shared(
     }
 
     if cx.shared.layout.scrape_examples_extension {
-        write_minify("scrape-examples.js", static_files::SCRAPE_EXAMPLES_JS, cx, options)?;
+        cx.write_minify(
+            SharedResource::Unversioned { name: "scrape-examples.js" },
+            static_files::SCRAPE_EXAMPLES_JS,
+            options.enable_minification,
+            &options.emit,
+        )?;
     }
 
     if let Some(ref css) = cx.shared.layout.css_file_extension {
diff --git a/src/librustdoc/html/static/js/scrape-examples.js b/src/librustdoc/html/static/js/scrape-examples.js
index a51fee55841..191ce37d653 100644
--- a/src/librustdoc/html/static/js/scrape-examples.js
+++ b/src/librustdoc/html/static/js/scrape-examples.js
@@ -1,3 +1,5 @@
+/* global addClass, hasClass, removeClass, onEach */
+
 (function () {
     // Scroll code block to put the given code location in the middle of the viewer
     function scrollToLoc(elt, loc) {