From 8f6523a94c42df7adac708bf6efbbe93beba2454 Mon Sep 17 00:00:00 2001 From: Jacob Wahlgren Date: Sat, 7 Oct 2017 18:11:05 +0200 Subject: [PATCH] Fix some clippy warnings --- src/bin/watch.rs | 2 +- src/renderer/html_handlebars/hbs_renderer.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/watch.rs b/src/bin/watch.rs index 132d680d..811d1394 100644 --- a/src/bin/watch.rs +++ b/src/bin/watch.rs @@ -73,7 +73,7 @@ where Ok(w) => w, Err(e) => { println!("Error while trying to watch the files:\n\n\t{:?}", e); - ::std::process::exit(0); + ::std::process::exit(0) } }; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 3ff914d6..2d8ab7fd 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -79,7 +79,7 @@ impl HtmlHandlebars { let filepath = Path::new(&ch.path).with_extension("html"); let rendered = self.post_process( rendered, - &normalize_path(filepath.to_str().ok_or(Error::from( + &normalize_path(filepath.to_str().ok_or_else(|| Error::from( format!("Bad file name: {}", filepath.display()), ))?), ctx.book.get_html_config().get_playpen_config(), @@ -129,8 +129,8 @@ impl HtmlHandlebars { filepath: &str, playpen_config: &PlaypenConfig) -> String { - let rendered = build_header_links(&rendered, &filepath); - let rendered = fix_anchor_links(&rendered, &filepath); + let rendered = build_header_links(&rendered, filepath); + let rendered = fix_anchor_links(&rendered, filepath); let rendered = fix_code_blocks(&rendered); let rendered = add_playpen_pre(&rendered, playpen_config); @@ -470,7 +470,7 @@ fn id_from_content(content: &str) -> String { } // Remove spaces and hastags indicating a header - let trimmed = content.trim().trim_left_matches("#").trim(); + let trimmed = content.trim().trim_left_matches('#').trim(); normalize_id(trimmed) }