diff --git a/components/config/src/config/mod.rs b/components/config/src/config/mod.rs index 06dd1a6b80..a79542e85e 100644 --- a/components/config/src/config/mod.rs +++ b/components/config/src/config/mod.rs @@ -37,7 +37,7 @@ fn build_ignore_glob_set(ignore: &Vec, name: &str) -> Result { }; 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)] diff --git a/components/config/src/config/search.rs b/components/config/src/config/search.rs index 26c78f7464..6f64cc20e3 100644 --- a/components/config/src/config/search.rs +++ b/components/config/src/config/search.rs @@ -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 { diff --git a/components/imageproc/src/format.rs b/components/imageproc/src/format.rs index 4ff2221ba1..d7c992eab8 100644 --- a/components/imageproc/src/format.rs +++ b/components/imageproc/src/format.rs @@ -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(&self, hasher: &mut H) { use Format::*; diff --git a/components/site/src/link_checking.rs b/components/site/src/link_checking.rs index a210f6c344..b5c1ed2186 100644 --- a/components/site/src/link_checking.rs +++ b/components/site/src/link_checking.rs @@ -253,7 +253,7 @@ pub fn check_external_links(site: &Site) -> Vec { 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::>() diff --git a/components/templates/src/filters.rs b/components/templates/src/filters.rs index 432f2b3d22..3b93f6a1f3 100644 --- a/components/templates/src/filters.rs +++ b/components/templates/src/filters.rs @@ -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())) } } } diff --git a/components/utils/src/fs.rs b/components/utils/src/fs.rs index f2e5093f87..f05884f4ef 100644 --- a/components/utils/src/fs.rs +++ b/components/utils/src/fs.rs @@ -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; } } diff --git a/components/utils/src/slugs.rs b/components/utils/src/slugs.rs index acacd1ee20..d1b099e00d 100644 --- a/components/utils/src/slugs.rs +++ b/components/utils/src/slugs.rs @@ -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));