From 19aaf6fdcde419d3f8f157d6b91471a4d4e4ff1c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 5 Sep 2017 21:36:41 +0100 Subject: [PATCH] Reduce compiler warnings --- src/build/mod.rs | 2 +- src/build/pandoc.rs | 11 +++++------ src/build/render.rs | 1 - src/renderers/html_cleanup.rs | 5 +---- src/renderers/mod.rs | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/build/mod.rs b/src/build/mod.rs index 341368e..7924610 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -5,7 +5,7 @@ use config::Config; pub fn build_input(config: Config, input: String) -> Result { - let html = try!(pandoc::render(config.clone(), input)); + let html = try!(pandoc::render(input)); let rendered = try!(render::render(config.clone(), html)); return Ok(rendered); } diff --git a/src/build/pandoc.rs b/src/build/pandoc.rs index 4c5174b..dac26dd 100644 --- a/src/build/pandoc.rs +++ b/src/build/pandoc.rs @@ -1,10 +1,9 @@ -use config::Config; use pandoc::{self, Pandoc, PandocOutput, PandocError}; -use std::env::{current_dir, current_exe}; -use std::path::PathBuf; +use std::env::current_exe; use std::error::Error; -fn execute_pandoc(config: Config, input: String) -> Result { + +fn execute_pandoc(input: String) -> Result { let mut renderer = Pandoc::new(); renderer.set_output_format(pandoc::OutputFormat::Html, vec![]); renderer.set_input_format(pandoc::InputFormat::Markdown, vec![]); @@ -17,8 +16,8 @@ fn execute_pandoc(config: Config, input: String) -> Result Result { - let output = execute_pandoc(config, input); +pub fn render(input: String) -> Result { + let output = execute_pandoc(input); if output.is_err() { return Err(output.err().unwrap().description().into()); } diff --git a/src/build/render.rs b/src/build/render.rs index 3010edc..4ef3c0c 100644 --- a/src/build/render.rs +++ b/src/build/render.rs @@ -1,5 +1,4 @@ use config::Config; -use std::char; use renderers::html_cleanup::html_cleanup; use renderers::strip_blank::strip_blank; diff --git a/src/renderers/html_cleanup.rs b/src/renderers/html_cleanup.rs index d07f156..e4ada8e 100644 --- a/src/renderers/html_cleanup.rs +++ b/src/renderers/html_cleanup.rs @@ -1,14 +1,11 @@ use renderers::{sciter_start, get_html, destroy_matching, destroy_at, find_first}; use config::Config; -use sciter::{Window}; -use std::ops::Deref; -use std::rc::Rc; pub fn html_cleanup(config: Config, input: String) -> Result { let mut root = sciter_start(input); let mut head = find_first(&mut root, "head"); - destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason + destroy_at(&mut head, 4); // Sciter doesnt like finding this style tag for some reason destroy_matching(&mut head, "meta[content='text/css']"); destroy_matching(&mut head, "style"); destroy_matching(&mut head, "title"); diff --git a/src/renderers/mod.rs b/src/renderers/mod.rs index 1f9eeef..6e33d56 100644 --- a/src/renderers/mod.rs +++ b/src/renderers/mod.rs @@ -16,7 +16,7 @@ fn sciter_start(source: String) -> Element { } fn get_html(element: Element) -> String { - element.update(true); + element.update(true).expect("Failed to update"); return String::from_utf8(element.get_html(true)).expect(&format!( "Failed to get HTML from {}.", element.get_tag()