about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2025-01-10 16:45:32 -0600
committerbinarycat <binarycat@envs.net>2025-01-11 12:33:25 -0600
commitd4057e8df01a2d1b580952e1be4099347bd5c27a (patch)
tree85ab18c0c62272a87585fa353f5ce04acee219f9 /src/librustdoc/html
parent251206c27b619ccf3a08e2ac4c525dc343f08492 (diff)
downloadrust-d4057e8df01a2d1b580952e1be4099347bd5c27a.tar.gz
rust-d4057e8df01a2d1b580952e1be4099347bd5c27a.zip
re-add --disable-minification to rustdoc
this also makes the rust.docs-minification option work
as advertised in config.toml

nothing fancy this time, this is intended to be perma-unstable.
it's only really here for the benefit of rustdoc devs.

mitegates https://github.com/rust-lang/rust/issues/135345
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/write_shared.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs
index ce10e5ecc24..fb6f3bc2c76 100644
--- a/src/librustdoc/html/render/write_shared.rs
+++ b/src/librustdoc/html/render/write_shared.rs
@@ -207,7 +207,15 @@ fn write_static_files(
     if opt.emit.is_empty() || opt.emit.contains(&EmitType::Toolchain) {
         static_files::for_each(|f: &static_files::StaticFile| {
             let filename = static_dir.join(f.output_filename());
-            fs::write(&filename, f.minified()).map_err(|e| PathError::new(e, &filename))
+            let contents: &[u8];
+            let contents_vec: Vec<u8>;
+            if opt.disable_minification {
+                contents = f.bytes;
+            } else {
+                contents_vec = f.minified();
+                contents = &contents_vec;
+            };
+            fs::write(&filename, contents).map_err(|e| PathError::new(e, &filename))
         })?;
     }