Clippy
This commit is contained in:
parent
6b0585cf01
commit
24304fa9c6
@ -37,7 +37,7 @@ fn build_ignore_glob_set(ignore: &Vec<String>, name: &str) -> Result<GlobSet> {
|
||||
};
|
||||
glob_set_builder.add(glob);
|
||||
}
|
||||
Ok(glob_set_builder.build().expect(&format!("Bad ignored_{} in config file.", name)))
|
||||
Ok(glob_set_builder.build().unwrap_or_else(|_| panic!("Bad ignored_{} in config file.", name)))
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
|
@ -2,17 +2,13 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[derive(Default)]
|
||||
pub enum IndexFormat {
|
||||
ElasticlunrJson,
|
||||
#[default]
|
||||
ElasticlunrJavascript,
|
||||
}
|
||||
|
||||
impl Default for IndexFormat {
|
||||
fn default() -> IndexFormat {
|
||||
IndexFormat::ElasticlunrJavascript
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Search {
|
||||
|
@ -48,7 +48,7 @@ impl Format {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::derive_hash_xor_eq)]
|
||||
#[allow(clippy::derived_hash_with_manual_eq)]
|
||||
impl Hash for Format {
|
||||
fn hash<H: Hasher>(&self, hasher: &mut H) {
|
||||
use Format::*;
|
||||
|
@ -253,7 +253,7 @@ pub fn check_external_links(site: &Site) -> Vec<String> {
|
||||
None
|
||||
} else {
|
||||
checked_links.insert(external_link, Some(res.clone()));
|
||||
return Some((&link_def.file_path, external_link, res));
|
||||
Some((&link_def.file_path, external_link, res))
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
@ -88,7 +88,7 @@ pub struct RegexReplaceFilter {
|
||||
|
||||
impl RegexReplaceFilter {
|
||||
pub fn new() -> Self {
|
||||
return Self { re_cache: Arc::new(Mutex::new(HashMap::new())) };
|
||||
Self { re_cache: Arc::new(Mutex::new(HashMap::new())) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ pub fn copy_directory(
|
||||
let relative_path = entry.path().strip_prefix(src).unwrap();
|
||||
|
||||
if let Some(gs) = ignore_globset {
|
||||
if gs.is_match(&relative_path) {
|
||||
if gs.is_match(relative_path) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[derive(Default)]
|
||||
pub enum SlugifyStrategy {
|
||||
/// Classic slugification, the default
|
||||
#[default]
|
||||
On,
|
||||
/// No slugification, only remove unsafe characters for filepaths/urls
|
||||
Safe,
|
||||
@ -12,12 +14,6 @@ pub enum SlugifyStrategy {
|
||||
Off,
|
||||
}
|
||||
|
||||
impl Default for SlugifyStrategy {
|
||||
fn default() -> Self {
|
||||
SlugifyStrategy::On
|
||||
}
|
||||
}
|
||||
|
||||
fn strip_chars(s: &str, chars: &str) -> String {
|
||||
let mut sanitized_string = s.to_string();
|
||||
sanitized_string.retain(|c| !chars.contains(c));
|
||||
|
Loading…
x
Reference in New Issue
Block a user