Reduce compiler warnings
This commit is contained in:
parent
51d82ff192
commit
9f15c57970
8 changed files with 6 additions and 17 deletions
|
@ -28,11 +28,6 @@ fn get_csl_data(csl_name: String) -> Result<String, String> {
|
||||||
return Ok(csl_buffer);
|
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 {
|
pub fn unpack_csl(csl_name: String) -> PathBuf {
|
||||||
let file = get_temp_file();
|
let file = get_temp_file();
|
||||||
let mut csl_temp = File::create(&file).expect("Failed to open temporary file");
|
let mut csl_temp = File::create(&file).expect("Failed to open temporary file");
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
use serde_yaml::Value;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use utils::{result_prefix, resolve_path, result_override};
|
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::env::current_dir;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,6 @@ pub fn find_first(root: &mut Element, selector: &str) -> Element {
|
||||||
return all_matches.pop().expect(&format!("Failed to find {}.", selector));
|
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) {
|
pub fn destroy_matching(root: &mut Element, selector: &str) {
|
||||||
let matches = find_all(root, selector);
|
let matches = find_all(root, selector);
|
||||||
if matches.is_empty() {
|
if matches.is_empty() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use sciter::Element;
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
|
||||||
|
|
||||||
pub fn head_cleanup(config: Config, input: String) -> Result<String, String> {
|
pub fn head_cleanup(_: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
let mut head = get_head(&mut root);
|
let mut head = get_head(&mut root);
|
||||||
destroy_matching(&mut head, "meta[content='text/css']");
|
destroy_matching(&mut head, "meta[content='text/css']");
|
||||||
|
|
|
@ -3,7 +3,7 @@ use config::Config;
|
||||||
use utils::{resolve_path, path_to_string};
|
use utils::{resolve_path, path_to_string};
|
||||||
|
|
||||||
|
|
||||||
pub fn images(config: Config, input: String) -> Result<String, String> {
|
pub fn images(_: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
let mut body = get_body(&mut root);
|
let mut body = get_body(&mut root);
|
||||||
let images = find_all(&mut body, "img[src]");
|
let images = find_all(&mut body, "img[src]");
|
||||||
|
|
|
@ -2,7 +2,7 @@ use html::{sciter_start, get_html, get_head, find_first};
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
|
||||||
|
|
||||||
pub fn rebrand(config: Config, input: String) -> Result<String, String> {
|
pub fn rebrand(_: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
let mut head = get_head(&mut root);
|
let mut head = get_head(&mut root);
|
||||||
let mut ele = find_first(&mut head, "meta[name='generator']");
|
let mut ele = find_first(&mut head, "meta[name='generator']");
|
||||||
|
|
|
@ -10,7 +10,7 @@ fn create_title() -> Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn references(config: Config, input: String) -> Result<String, String> {
|
pub fn references(_: Config, input: String) -> Result<String, String> {
|
||||||
let mut root = sciter_start(input);
|
let mut root = sciter_start(input);
|
||||||
let mut body = get_body(&mut root);
|
let mut body = get_body(&mut root);
|
||||||
let possible_references = body.find_first("div#refs").expect("Failed to get refs");
|
let possible_references = body.find_first("div#refs").expect("Failed to get refs");
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn remove_blank_lines(line: &&str) -> bool {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn strip_blank(config: Config, input: String) -> Result<String, String> {
|
pub fn strip_blank(_w: Config, input: String) -> Result<String, String> {
|
||||||
let split: Vec<&str> = input.lines().filter(remove_blank_lines).collect();
|
let split: Vec<&str> = input.lines().filter(remove_blank_lines).collect();
|
||||||
return Ok(split.join("\n"));
|
return Ok(split.join("\n"));
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue