mirror of
https://github.com/getzola/zola
synced 2024-11-10 14:24:27 +00:00
Clippy run
This commit is contained in:
parent
e1ee6b9dc4
commit
f58e416b96
6 changed files with 10 additions and 10 deletions
|
@ -138,12 +138,12 @@ impl Config {
|
|||
let original = config_extra.clone();
|
||||
// 2. inject theme extra values
|
||||
for (key, val) in &theme.extra {
|
||||
config_extra.entry(key.to_string()).or_insert(val.clone());
|
||||
config_extra.entry(key.to_string()).or_insert_with(|| val.clone());
|
||||
}
|
||||
|
||||
// 3. overwrite with original config
|
||||
for (key, val) in &original {
|
||||
config_extra.entry(key.to_string()).or_insert(val.clone());
|
||||
config_extra.entry(key.to_string()).or_insert_with(|| val.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ impl Default for Config {
|
|||
description: None,
|
||||
language_code: Some("en".to_string()),
|
||||
generate_rss: Some(false),
|
||||
rss_limit: Some(10000),
|
||||
rss_limit: Some(10_000),
|
||||
generate_tags_pages: Some(true),
|
||||
generate_categories_pages: Some(true),
|
||||
insert_anchor_links: Some(false),
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Theme {
|
|||
};
|
||||
|
||||
let mut extra = HashMap::new();
|
||||
if let Some(ref theme_table) = theme.as_table() {
|
||||
if let Some(theme_table) = theme.as_table() {
|
||||
if let Some(ex) = theme_table.get("extra") {
|
||||
if ex.is_table() {
|
||||
extra = ex.clone().try_into().unwrap();
|
||||
|
|
|
@ -131,14 +131,14 @@ fn bench_sorting_order(b: &mut test::Bencher) {
|
|||
fn bench_populate_previous_and_next_pages(b: &mut test::Bencher) {
|
||||
let pages = create_pages(250, SortBy::Order);
|
||||
let (sorted_pages, _) = sort_pages(pages, SortBy::Order);
|
||||
b.iter(|| populate_previous_and_next_pages(sorted_pages.clone()));
|
||||
b.iter(|| populate_previous_and_next_pages(&sorted_pages.clone()));
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_page_render_html(b: &mut test::Bencher) {
|
||||
let pages = create_pages(10, SortBy::Order);
|
||||
let (mut sorted_pages, _) = sort_pages(pages, SortBy::Order);
|
||||
sorted_pages = populate_previous_and_next_pages(sorted_pages.clone());
|
||||
sorted_pages = populate_previous_and_next_pages(&sorted_pages);
|
||||
|
||||
let config = Config::default();
|
||||
let mut tera = Tera::default();
|
||||
|
|
|
@ -629,7 +629,7 @@ impl Site {
|
|||
|
||||
let sitemap = &render_template("sitemap.xml", &self.tera, &context, self.config.theme.clone())?;
|
||||
|
||||
create_file(&self.output_path.join("sitemap.xml"), &sitemap)?;
|
||||
create_file(&self.output_path.join("sitemap.xml"), sitemap)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ impl Site {
|
|||
|
||||
let feed = &render_template("rss.xml", &self.tera, &context, self.config.theme.clone())?;
|
||||
|
||||
create_file(&self.output_path.join("rss.xml"), &feed)?;
|
||||
create_file(&self.output_path.join("rss.xml"), feed)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ pub fn make_get_url(permalinks: HashMap<String, String>, config: Config) -> Glob
|
|||
if cachebust {
|
||||
permalink = format!("{}?t={}", permalink, config.build_timestamp.unwrap());
|
||||
}
|
||||
return Ok(to_value(permalink).unwrap());
|
||||
Ok(to_value(permalink).unwrap())
|
||||
}
|
||||
},
|
||||
Err(_) => Err(format!("`get_url` received path={:?} but it requires a string", val).into()),
|
||||
|
|
|
@ -12,7 +12,7 @@ fn read_line() -> Result<String> {
|
|||
lines
|
||||
.next()
|
||||
.and_then(|l| l.ok())
|
||||
.ok_or("unable to read from stdin for confirmation".into())
|
||||
.ok_or_else(|| "unable to read from stdin for confirmation".into())
|
||||
}
|
||||
|
||||
/// Ask a yes/no question to the user
|
||||
|
|
Loading…
Reference in a new issue