diff --git a/components/library/src/content/section.rs b/components/library/src/content/section.rs index 05c1b31..76f6618 100644 --- a/components/library/src/content/section.rs +++ b/components/library/src/content/section.rs @@ -80,7 +80,7 @@ impl Section { pub fn parse(file_path: &Path, content: &str, config: &Config) -> Result
{ let (meta, content) = split_section_content(file_path, content)?; let mut section = Section::new(file_path, meta); - section.raw_content = content.clone(); + section.raw_content = content; let (word_count, reading_time) = get_reading_analytics(§ion.raw_content); section.word_count = Some(word_count); section.reading_time = Some(reading_time); diff --git a/components/rendering/src/markdown.rs b/components/rendering/src/markdown.rs index 7ec4fc1..c21e58b 100644 --- a/components/rendering/src/markdown.rs +++ b/components/rendering/src/markdown.rs @@ -31,7 +31,7 @@ pub struct Rendered { // means we will have example, example-1, example-2 etc fn find_anchor(anchors: &[String], name: String, level: u8) -> String { if level == 0 && !anchors.contains(&name) { - return name.to_string(); + return name; } let new_anchor = format!("{}-{}", name, level + 1); diff --git a/components/rendering/src/shortcode.rs b/components/rendering/src/shortcode.rs index 294eee3..d292e86 100644 --- a/components/rendering/src/shortcode.rs +++ b/components/rendering/src/shortcode.rs @@ -20,9 +20,9 @@ lazy_static! { fn replace_string_markers(input: &str) -> String { match input.chars().next().unwrap() { - '"' => input.replace('"', "").to_string(), - '\'' => input.replace('\'', "").to_string(), - '`' => input.replace('`', "").to_string(), + '"' => input.replace('"', ""), + '\'' => input.replace('\'', ""), + '`' => input.replace('`', ""), _ => unreachable!("How did you even get there"), } } diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index bee3a4c..3df0686 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -771,7 +771,7 @@ impl Site { pages.par_sort_unstable_by(sort_actual_pages_by_date); - context.insert("last_build_date", &pages[0].meta.date.clone().map(|d| d.to_string())); + context.insert("last_build_date", &pages[0].meta.date.clone()); // limit to the last n elements if the limit is set; otherwise use all. let num_entries = self.config.rss_limit.unwrap_or(pages.len()); let p = pages @@ -794,7 +794,7 @@ impl Site { let feed = &render_template("rss.xml", &self.tera, &context, &self.config.theme)?; if let Some(ref base) = base_path { - let mut output_path = self.output_path.clone().to_path_buf(); + let mut output_path = self.output_path.clone(); for component in base.components() { output_path.push(component); if !output_path.exists() { @@ -812,9 +812,7 @@ impl Site { /// Renders a single section pub fn render_section(&self, section: &Section, render_pages: bool) -> Result<()> { ensure_directory_exists(&self.output_path)?; - let public = self.output_path.clone(); - - let mut output_path = public.to_path_buf(); + let mut output_path = self.output_path.clone(); for component in §ion.file.components { output_path.push(component); diff --git a/components/templates/src/global_fns/mod.rs b/components/templates/src/global_fns/mod.rs index 2ba5aad..5c8deb5 100644 --- a/components/templates/src/global_fns/mod.rs +++ b/components/templates/src/global_fns/mod.rs @@ -184,8 +184,8 @@ pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn { } }; - if let Some(ref permalink) = container.get(&name) { - return Ok(to_value(permalink.clone()).unwrap()); + if let Some(permalink) = container.get(&name) { + return Ok(to_value(permalink).unwrap()); } Err(format!("`get_taxonomy_url`: couldn't find `{}` in `{}` taxonomy", name, kind).into()) @@ -226,7 +226,7 @@ pub fn make_resize_image(imageproc: Arc>) -> GlobalF return Err(format!("`resize_image`: Cannot find path: {}", path).into()); } - let imageop = imageproc::ImageOp::from_args(path.clone(), &op, width, height, quality) + let imageop = imageproc::ImageOp::from_args(path, &op, width, height, quality) .map_err(|e| format!("`resize_image`: {}", e))?; let url = imageproc.insert(imageop);