From 9440a3d5f464696615419d9f15459c928538b869 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 23 Oct 2022 11:16:53 +0300 Subject: chore: simplify code based on clippy suggestions Sponsored-by: author --- src/pagespec.rs | 12 ++---------- 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 = glob.chars().collect(); let path: Vec = 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, SiteError> { -- cgit v1.2.1