diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs index af1c50acb0a..eb8eabe1c03 100644 --- a/src/librustdoc/theme.rs +++ b/src/librustdoc/theme.rs @@ -179,20 +179,23 @@ fn get_previous_positions(events: &[Events], mut pos: usize) -> Vec { } fn build_rule(v: &[u8], positions: &[usize]) -> String { - positions - .chunks(2) - .map(|x| ::std::str::from_utf8(&v[x[0]..x[1]]).unwrap_or("")) - .collect::() - .trim() - .replace("\n", " ") - .replace("/", "") - .replace("\t", " ") - .replace("{", "") - .replace("}", "") - .split(' ') - .filter(|s| s.len() > 0) - .collect::>() - .join(" ") + minifier::css::minify( + &positions + .chunks(2) + .map(|x| ::std::str::from_utf8(&v[x[0]..x[1]]).unwrap_or("")) + .collect::() + .trim() + .replace("\n", " ") + .replace("/", "") + .replace("\t", " ") + .replace("{", "") + .replace("}", "") + .split(' ') + .filter(|s| s.len() > 0) + .collect::>() + .join(" "), + ) + .unwrap_or_else(|_| String::new()) } fn inner(v: &[u8], events: &[Events], pos: &mut usize) -> FxHashSet {