From cf1f8317bbf7d00b503b15471c5a21496c02fdad Mon Sep 17 00:00:00 2001 From: James Munns Date: Fri, 20 Apr 2018 17:54:05 +0200 Subject: [PATCH] Reduce the number of allocations --- components/site/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 2af66085..6c5fdd28 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -604,13 +604,13 @@ impl Site { // If the alias ends with an html file name, use that instead of mapping // as a path containing an `index.html` - let page_name: String = match split.pop() { - Some(part) if part.ends_with(".html") => part.to_string(), + let page_name = match split.pop() { + Some(part) if part.ends_with(".html") => part, Some(part) => { split.push(part); - "index.html".into() + "index.html" } - None => "index.html".into() + None => "index.html" }; for component in split { @@ -620,7 +620,7 @@ impl Site { create_directory(&output_path)?; } } - create_file(&output_path.join(&page_name), &render_redirect_template(&page.permalink, &self.tera)?)?; + create_file(&output_path.join(page_name), &render_redirect_template(&page.permalink, &self.tera)?)?; } } Ok(())