Some clippy fixes
This commit is contained in:
parent
0afd31d660
commit
fc808f2aa8
|
@ -59,7 +59,7 @@ impl Markdown {
|
||||||
pub fn construct_external_link_tag(&self, url: &str, title: &str) -> String {
|
pub fn construct_external_link_tag(&self, url: &str, title: &str) -> String {
|
||||||
let mut rel_opts = Vec::new();
|
let mut rel_opts = Vec::new();
|
||||||
let mut target = "".to_owned();
|
let mut target = "".to_owned();
|
||||||
let title = if title == "" { "".to_owned() } else { format!("title=\"{}\" ", title) };
|
let title = if title.is_empty() { "".to_owned() } else { format!("title=\"{}\" ", title) };
|
||||||
|
|
||||||
if self.external_links_target_blank {
|
if self.external_links_target_blank {
|
||||||
// Security risk otherwise
|
// Security risk otherwise
|
||||||
|
|
|
@ -3,9 +3,7 @@ use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
||||||
use errors::{bail, Error, Result};
|
use errors::{bail, Error, Result};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde_yaml;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use toml;
|
|
||||||
|
|
||||||
mod page;
|
mod page;
|
||||||
mod section;
|
mod section;
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl PageFrontMatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref path) = f.path {
|
if let Some(ref path) = f.path {
|
||||||
if path == "" {
|
if path.is_empty() {
|
||||||
bail!("`path` can't be empty if present")
|
bail!("`path` can't be empty if present")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,8 +319,7 @@ impl ImageOp {
|
||||||
Some(q) => encoder.encode(q as f32 / 100.),
|
Some(q) => encoder.encode(q as f32 / 100.),
|
||||||
None => encoder.encode_lossless(),
|
None => encoder.encode_lossless(),
|
||||||
};
|
};
|
||||||
let mut bytes = memory.as_bytes();
|
f.write_all(&memory.as_bytes())?;
|
||||||
f.write_all(&mut bytes)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ impl Library {
|
||||||
let file_path = section.file.path.clone();
|
let file_path = section.file.path.clone();
|
||||||
let rel_path = section.path.clone();
|
let rel_path = section.path.clone();
|
||||||
|
|
||||||
let mut entries = vec![rel_path.clone()];
|
let mut entries = vec![rel_path];
|
||||||
entries.extend(section.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
|
entries.extend(section.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
|
||||||
self.insert_reverse_aliases(entries, §ion.file.relative);
|
self.insert_reverse_aliases(entries, §ion.file.relative);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ impl Library {
|
||||||
let file_path = page.file.path.clone();
|
let file_path = page.file.path.clone();
|
||||||
let rel_path = page.path.clone();
|
let rel_path = page.path.clone();
|
||||||
|
|
||||||
let mut entries = vec![rel_path.clone()];
|
let mut entries = vec![rel_path];
|
||||||
entries.extend(page.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
|
entries.extend(page.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
|
||||||
self.insert_reverse_aliases(entries, &page.file.relative);
|
self.insert_reverse_aliases(entries, &page.file.relative);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use std::fs::{canonicalize, create_dir};
|
use std::fs::{canonicalize, create_dir};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use errors::{bail, Result};
|
use errors::{bail, Result};
|
||||||
use utils::fs::create_file;
|
use utils::fs::create_file;
|
||||||
|
@ -68,7 +67,7 @@ pub fn is_directory_quasi_empty(path: &Path) -> Result<bool> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the unc part of a windows path
|
// Remove the unc part of a windows path
|
||||||
fn strip_unc(path: &PathBuf) -> String {
|
fn strip_unc(path: &Path) -> String {
|
||||||
let path_to_refine = path.to_str().unwrap();
|
let path_to_refine = path.to_str().unwrap();
|
||||||
path_to_refine.trim_start_matches(LOCAL_UNC).to_string()
|
path_to_refine.trim_start_matches(LOCAL_UNC).to_string()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue