diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-10-23 11:16:53 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-10-23 11:16:53 +0300 |
commit | 9440a3d5f464696615419d9f15459c928538b869 (patch) | |
tree | 1db640681b3c748d012c8ba0573657087d953539 | |
parent | a820d18e740cbb1df5bb97ac089fe6398a62bf85 (diff) | |
download | riki-9440a3d5f464696615419d9f15459c928538b869.tar.gz |
chore: simplify code based on clippy suggestions
Sponsored-by: author
-rw-r--r-- | src/pagespec.rs | 12 | ||||
-rw-r--r-- | src/site.rs | 6 |
2 files changed, 3 insertions, 15 deletions
diff --git a/src/pagespec.rs b/src/pagespec.rs index 1ebb1b1..55c83fb 100644 --- a/src/pagespec.rs +++ b/src/pagespec.rs @@ -93,11 +93,7 @@ pub enum OpCode { fn glob_matches(glob: &str, path: &str) -> bool { let glob: Vec<char> = glob.chars().collect(); let path: Vec<char> = path.chars().collect(); - if glob_matches_helper(&glob, &path) { - true - } else { - false - } + glob_matches_helper(&glob, &path) } fn glob_matches_helper(mut glob: &[char], mut path: &[char]) -> bool { @@ -141,11 +137,7 @@ fn glob_matches_helper(mut glob: &[char], mut path: &[char]) -> bool { fn page_matches(site: &Site, container: &Path, glob: &str, path: &str) -> bool { if glob_matches(glob, path) { let full_path = container.join(path); - if site.is_page(&full_path) { - true - } else { - false - } + site.is_page(&full_path) } else { false } diff --git a/src/site.rs b/src/site.rs index 10fa923..6fa4625 100644 --- a/src/site.rs +++ b/src/site.rs @@ -118,11 +118,7 @@ impl Site { } pub fn is_page(&self, path: &Path) -> bool { - if self.pages_that_will_exist.get(path).is_some() { - true - } else { - false - } + self.pages_that_will_exist.get(path).is_some() } fn all_files(&self) -> Result<Vec<Name>, SiteError> { |