Merge pull request #532 from sinkuu/redundant_clone
Remove redundant clone
This commit is contained in:
commit
4fa9d89ea8
|
@ -80,7 +80,7 @@ impl Section {
|
|||
pub fn parse(file_path: &Path, content: &str, config: &Config) -> Result<Section> {
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<Mutex<imageproc::Processor>>) -> 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue