From c38d9e56c8e99d61260878db1ae0283711ee5f79 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Sun, 23 May 2021 18:19:18 +0200 Subject: [PATCH] Do not clone ancestors when serializing --- components/library/src/content/ser.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/library/src/content/ser.rs b/components/library/src/content/ser.rs index 8d4a077b..83ab4964 100644 --- a/components/library/src/content/ser.rs +++ b/components/library/src/content/ser.rs @@ -69,7 +69,7 @@ pub struct SerializingPage<'a> { content: &'a str, permalink: &'a str, slug: &'a str, - ancestors: Vec, + ancestors: Vec<&'a str>, title: &'a Option, description: &'a Option, updated: &'a Option, @@ -138,7 +138,7 @@ impl<'a> SerializingPage<'a> { let ancestors = page .ancestors .iter() - .map(|k| library.get_section_by_key(*k).file.relative.clone()) + .map(|k| library.get_section_by_key(*k).file.relative.as_str()) .collect(); let translations = TranslatedContent::find_all_pages(page, library); @@ -197,7 +197,7 @@ impl<'a> SerializingPage<'a> { let ancestors = if let Some(ref lib) = library { page.ancestors .iter() - .map(|k| lib.get_section_by_key(*k).file.relative.clone()) + .map(|k| lib.get_section_by_key(*k).file.relative.as_str()) .collect() } else { vec![] @@ -251,7 +251,7 @@ pub struct SerializingSection<'a> { relative_path: &'a str, content: &'a str, permalink: &'a str, - ancestors: Vec, + ancestors: Vec<&'a str>, title: &'a Option, description: &'a Option, extra: &'a Map, @@ -283,7 +283,7 @@ impl<'a> SerializingSection<'a> { let ancestors = section .ancestors .iter() - .map(|k| library.get_section_by_key(*k).file.relative.clone()) + .map(|k| library.get_section_by_key(*k).file.relative.as_str()) .collect(); let translations = TranslatedContent::find_all_sections(section, library); @@ -317,7 +317,7 @@ impl<'a> SerializingSection<'a> { ancestors = section .ancestors .iter() - .map(|k| lib.get_section_by_key(*k).file.relative.clone()) + .map(|k| lib.get_section_by_key(*k).file.relative.as_str()) .collect(); translations = TranslatedContent::find_all_sections(section, lib); subsections =