Skip to content

Commit 24304fa

Browse files
committed
Clippy
1 parent 6b0585c commit 24304fa

7 files changed

Lines changed: 9 additions & 17 deletions

File tree

components/config/src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn build_ignore_glob_set(ignore: &Vec<String>, name: &str) -> Result<GlobSet> {
3737
};
3838
glob_set_builder.add(glob);
3939
}
40-
Ok(glob_set_builder.build().expect(&format!("Bad ignored_{} in config file.", name)))
40+
Ok(glob_set_builder.build().unwrap_or_else(|_| panic!("Bad ignored_{} in config file.", name)))
4141
}
4242

4343
#[derive(Clone, Debug, Deserialize)]

components/config/src/config/search.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@ use serde::{Deserialize, Serialize};
22

33
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
44
#[serde(rename_all = "snake_case")]
5+
#[derive(Default)]
56
pub enum IndexFormat {
67
ElasticlunrJson,
8+
#[default]
79
ElasticlunrJavascript,
810
}
911

10-
impl Default for IndexFormat {
11-
fn default() -> IndexFormat {
12-
IndexFormat::ElasticlunrJavascript
13-
}
14-
}
15-
1612
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
1713
#[serde(default)]
1814
pub struct Search {

components/imageproc/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Format {
4848
}
4949
}
5050

51-
#[allow(clippy::derive_hash_xor_eq)]
51+
#[allow(clippy::derived_hash_with_manual_eq)]
5252
impl Hash for Format {
5353
fn hash<H: Hasher>(&self, hasher: &mut H) {
5454
use Format::*;

components/site/src/link_checking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub fn check_external_links(site: &Site) -> Vec<String> {
253253
None
254254
} else {
255255
checked_links.insert(external_link, Some(res.clone()));
256-
return Some((&link_def.file_path, external_link, res));
256+
Some((&link_def.file_path, external_link, res))
257257
}
258258
})
259259
.collect::<Vec<_>>()

components/templates/src/filters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub struct RegexReplaceFilter {
8888

8989
impl RegexReplaceFilter {
9090
pub fn new() -> Self {
91-
return Self { re_cache: Arc::new(Mutex::new(HashMap::new())) };
91+
Self { re_cache: Arc::new(Mutex::new(HashMap::new())) }
9292
}
9393
}
9494

components/utils/src/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub fn copy_directory(
128128
let relative_path = entry.path().strip_prefix(src).unwrap();
129129

130130
if let Some(gs) = ignore_globset {
131-
if gs.is_match(&relative_path) {
131+
if gs.is_match(relative_path) {
132132
continue;
133133
}
134134
}

components/utils/src/slugs.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@ use serde::{Deserialize, Serialize};
33

44
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
55
#[serde(rename_all = "lowercase")]
6+
#[derive(Default)]
67
pub enum SlugifyStrategy {
78
/// Classic slugification, the default
9+
#[default]
810
On,
911
/// No slugification, only remove unsafe characters for filepaths/urls
1012
Safe,
1113
/// Nothing is changed, hope for the best!
1214
Off,
1315
}
1416

15-
impl Default for SlugifyStrategy {
16-
fn default() -> Self {
17-
SlugifyStrategy::On
18-
}
19-
}
20-
2117
fn strip_chars(s: &str, chars: &str) -> String {
2218
let mut sanitized_string = s.to_string();
2319
sanitized_string.retain(|c| !chars.contains(c));

0 commit comments

Comments
 (0)