Browse Source

Clippy run

index-subcmd
Vincent Prouillet 7 years ago
parent
commit
f58e416b96
6 changed files with 10 additions and 10 deletions
  1. +3
    -3
      components/config/src/lib.rs
  2. +1
    -1
      components/config/src/theme.rs
  3. +2
    -2
      components/content/benches/all.rs
  4. +2
    -2
      components/site/src/lib.rs
  5. +1
    -1
      components/templates/src/global_fns.rs
  6. +1
    -1
      src/prompt.rs

+ 3
- 3
components/config/src/lib.rs View File

@@ -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),


+ 1
- 1
components/config/src/theme.rs View File

@@ -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();


+ 2
- 2
components/content/benches/all.rs View File

@@ -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();


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

@@ -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(())
}


+ 1
- 1
components/templates/src/global_fns.rs View File

@@ -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()),


+ 1
- 1
src/prompt.rs View File

@@ -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…
Cancel
Save