Browse Source

Reduce the number of allocations

index-subcmd
James Munns Vincent Prouillet 6 years ago
parent
commit
cf1f8317bb
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      components/site/src/lib.rs

+ 5
- 5
components/site/src/lib.rs View File

@@ -604,13 +604,13 @@ impl Site {


// If the alias ends with an html file name, use that instead of mapping // If the alias ends with an html file name, use that instead of mapping
// as a path containing an `index.html` // 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) => { Some(part) => {
split.push(part); split.push(part);
"index.html".into()
"index.html"
} }
None => "index.html".into()
None => "index.html"
}; };


for component in split { for component in split {
@@ -620,7 +620,7 @@ impl Site {
create_directory(&output_path)?; 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(()) Ok(())


Loading…
Cancel
Save