Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Dec 18, 2023
1 parent 6b0585c commit 24304fa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion components/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
8 changes: 2 additions & 6 deletions components/config/src/config/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion components/imageproc/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion components/site/src/link_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<_>>()
Expand Down
2 changes: 1 addition & 1 deletion components/templates/src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/utils/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
8 changes: 2 additions & 6 deletions components/utils/src/slugs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ 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,
/// Nothing is changed, hope for the best!
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));
Expand Down

0 comments on commit 24304fa

Please sign in to comment.