Skip to content

Commit edd26ad

Browse files
Update minifier version to 0.2.1
1 parent fee3a45 commit edd26ad

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -2391,9 +2391,9 @@ dependencies = [
23912391

23922392
[[package]]
23932393
name = "minifier"
2394-
version = "0.1.0"
2394+
version = "0.2.1"
23952395
source = "registry+https://github.com/rust-lang/crates.io-index"
2396-
checksum = "7071d17e2898e134cabf624f43cdefa0cedf57c739e964df3d0df9d028701a72"
2396+
checksum = "ac96d1e7a65f206443f95afff6de8f1690c77c97d6fc9c9bb2d2cd0662e9ff9f"
23972397

23982398
[[package]]
23992399
name = "minimal-lexical"

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ arrayvec = { version = "0.7", default-features = false }
1111
askama = { version = "0.11", default-features = false, features = ["config"] }
1212
atty = "0.2"
1313
pulldown-cmark = { version = "0.9", default-features = false }
14-
minifier = "0.1.0"
14+
minifier = "0.2.1"
1515
serde = { version = "1.0", features = ["derive"] }
1616
serde_json = "1.0"
1717
smallvec = "1.6.1"

src/librustdoc/html/render/write_shared.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ impl Context<'_> {
122122
if minify {
123123
let contents = contents.as_ref();
124124
let contents = if resource.extension() == Some(OsStr::new("css")) {
125-
minifier::css::minify(contents).map_err(|e| {
126-
Error::new(format!("failed to minify CSS file: {}", e), resource.path(self))
127-
})?
125+
minifier::css::minify(contents)
126+
.map_err(|e| {
127+
Error::new(format!("failed to minify CSS file: {}", e), resource.path(self))
128+
})?
129+
.to_string()
128130
} else {
129-
minifier::js::minify(contents)
131+
minifier::js::minify(contents).to_string()
130132
};
131133
self.write_shared(resource, contents, emit)
132134
} else {

src/librustdoc/theme.rs

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ fn build_rule(v: &[u8], positions: &[usize]) -> String {
185185
.intersperse(" ")
186186
.collect::<String>(),
187187
)
188+
.map(|css| css.to_string())
188189
.unwrap_or_else(|_| String::new())
189190
}
190191

src/librustdoc/theme/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn check_invalid_css() {
106106
#[test]
107107
fn test_with_minification() {
108108
let text = include_str!("../html/static/css/themes/dark.css");
109-
let minified = minifier::css::minify(&text).expect("CSS minification failed");
109+
let minified = minifier::css::minify(&text).expect("CSS minification failed").to_string();
110110

111111
let against = load_css_paths(text.as_bytes());
112112
let other = load_css_paths(minified.as_bytes());

0 commit comments

Comments
 (0)