From 9f15c579708a0c771fcaf63ba2eb40251b32f49c Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 21 Nov 2017 22:17:35 +0000 Subject: [PATCH] Reduce compiler warnings --- src/config/csl.rs | 5 ----- src/config/mod.rs | 3 +-- src/html.rs | 5 ----- src/processors/head_cleanup.rs | 2 +- src/processors/images.rs | 2 +- src/processors/rebrand.rs | 2 +- src/processors/references.rs | 2 +- src/processors/strip_blank.rs | 2 +- 8 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/config/csl.rs b/src/config/csl.rs index 6fc3c8f..f551cf6 100644 --- a/src/config/csl.rs +++ b/src/config/csl.rs @@ -28,11 +28,6 @@ fn get_csl_data(csl_name: String) -> Result { return Ok(csl_buffer); } -pub fn is_valid_csl(csl_name: String) -> bool { - return get_csl_data(csl_name).is_ok(); -} - - pub fn unpack_csl(csl_name: String) -> PathBuf { let file = get_temp_file(); let mut csl_temp = File::create(&file).expect("Failed to open temporary file"); diff --git a/src/config/mod.rs b/src/config/mod.rs index 133316f..475297b 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,9 +1,8 @@ use serde_yaml; -use serde_yaml::Value; use std::path::PathBuf; use std::collections::HashMap; use utils::{result_prefix, resolve_path, result_override}; -use std::fs::{remove_file, File}; +use std::fs::File; use std::env::current_dir; use std::io::Read; diff --git a/src/html.rs b/src/html.rs index 1f41d11..a506758 100644 --- a/src/html.rs +++ b/src/html.rs @@ -34,11 +34,6 @@ pub fn find_first(root: &mut Element, selector: &str) -> Element { return all_matches.pop().expect(&format!("Failed to find {}.", selector)); } -pub fn destroy_at(root: &mut Element, index: usize) { - let mut ele = root.get(index).expect(&format!("Failed to get element at {}.", index)); - ele.destroy().expect("Failed to delete."); -} - pub fn destroy_matching(root: &mut Element, selector: &str) { let matches = find_all(root, selector); if matches.is_empty() { diff --git a/src/processors/head_cleanup.rs b/src/processors/head_cleanup.rs index d44021f..9f0dc9a 100644 --- a/src/processors/head_cleanup.rs +++ b/src/processors/head_cleanup.rs @@ -3,7 +3,7 @@ use sciter::Element; use config::Config; -pub fn head_cleanup(config: Config, input: String) -> Result { +pub fn head_cleanup(_: Config, input: String) -> Result { let mut root = sciter_start(input); let mut head = get_head(&mut root); destroy_matching(&mut head, "meta[content='text/css']"); diff --git a/src/processors/images.rs b/src/processors/images.rs index 46c3068..03d2e02 100644 --- a/src/processors/images.rs +++ b/src/processors/images.rs @@ -3,7 +3,7 @@ use config::Config; use utils::{resolve_path, path_to_string}; -pub fn images(config: Config, input: String) -> Result { +pub fn images(_: Config, input: String) -> Result { let mut root = sciter_start(input); let mut body = get_body(&mut root); let images = find_all(&mut body, "img[src]"); diff --git a/src/processors/rebrand.rs b/src/processors/rebrand.rs index 21f3fbf..51061ca 100644 --- a/src/processors/rebrand.rs +++ b/src/processors/rebrand.rs @@ -2,7 +2,7 @@ use html::{sciter_start, get_html, get_head, find_first}; use config::Config; -pub fn rebrand(config: Config, input: String) -> Result { +pub fn rebrand(_: Config, input: String) -> Result { let mut root = sciter_start(input); let mut head = get_head(&mut root); let mut ele = find_first(&mut head, "meta[name='generator']"); diff --git a/src/processors/references.rs b/src/processors/references.rs index 20f1445..94be94d 100644 --- a/src/processors/references.rs +++ b/src/processors/references.rs @@ -10,7 +10,7 @@ fn create_title() -> Element { } -pub fn references(config: Config, input: String) -> Result { +pub fn references(_: Config, input: String) -> Result { let mut root = sciter_start(input); let mut body = get_body(&mut root); let possible_references = body.find_first("div#refs").expect("Failed to get refs"); diff --git a/src/processors/strip_blank.rs b/src/processors/strip_blank.rs index 2d91495..57bd8f3 100644 --- a/src/processors/strip_blank.rs +++ b/src/processors/strip_blank.rs @@ -12,7 +12,7 @@ fn remove_blank_lines(line: &&str) -> bool { return true; } -pub fn strip_blank(config: Config, input: String) -> Result { +pub fn strip_blank(_w: Config, input: String) -> Result { let split: Vec<&str> = input.lines().filter(remove_blank_lines).collect(); return Ok(split.join("\n")); }