From 03ebed627763dbc9d28280e04b3848a80ae5271c Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 31 May 2020 12:12:56 +0200 Subject: [PATCH] Improve rendering performance --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/format/html.rs | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6f9682..3245ed5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "snekdown" -version = "0.2.2" +version = "0.2.3" dependencies = [ "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index ff3b3d6..e12cd0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "snekdown" -version = "0.2.2" +version = "0.2.3" authors = ["trivernis "] edition = "2018" license-file = "LICENSE" diff --git a/src/format/html.rs b/src/format/html.rs index 862e96b..86be710 100644 --- a/src/format/html.rs +++ b/src/format/html.rs @@ -97,9 +97,8 @@ impl ToHtml for Section { fn to_html(&self) -> String { let inner = self .elements - .par_iter() - .map(|e| e.to_html()) - .reduce(|| "".to_string(), |a, b| format!("{}{}", a, b)); + .iter() + .fold("".to_string(), |a, b| format!("{}{}", a, b.to_html())); format!("
{}{}
", self.header.to_html(), inner) } }