diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-01-04 02:20:55 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-01-04 02:20:55 +0100 |
| commit | 8766e4412b95cfa0288683748cc20aba81a64d08 (patch) | |
| tree | b068bbd32915b2c0ca846465edfd6cb9bf718d6c /src/file_handler/mod.rs | |
| parent | b03284133baa6339fe4adf48e4a6499ef3ac287b (diff) | |
Address pedantic issues
Diffstat (limited to 'src/file_handler/mod.rs')
| -rw-r--r-- | src/file_handler/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/file_handler/mod.rs b/src/file_handler/mod.rs index 522bcbf..e8a446b 100644 --- a/src/file_handler/mod.rs +++ b/src/file_handler/mod.rs @@ -8,7 +8,7 @@ use std::fs::read_to_string; use std::path::{Path, PathBuf}; pub struct FileHandler { - pub strategies: Vec<Box<dyn FileHandlerStrategy>>, + pub strategies: Vec<Box<dyn Strategy>>, pub layout: Option<String>, } @@ -27,7 +27,7 @@ impl Default for FileHandler { impl FileHandler { pub fn identify(&self, path: &Path) -> FileType { - for strategy in self.strategies.iter() { + for strategy in &self.strategies { if strategy.is(path) { return strategy.identify(); } @@ -53,9 +53,9 @@ impl FileHandler { gemini_destination: &Path, files: &[File], ) { - files.iter().for_each(|file| { + for file in files { self.handle(source, html_destination, gemini_destination, file); - }); + } } pub fn handle( @@ -80,7 +80,7 @@ impl FileHandler { } } -pub trait FileHandlerStrategy { +pub trait Strategy { fn is(&self, path: &Path) -> bool; fn identify(&self) -> FileType; fn can_handle(&self, file_type: &FileType) -> bool; @@ -182,7 +182,7 @@ mod tests { file_type: FileType, } - impl FileHandlerStrategy for MockStrategy { + impl Strategy for MockStrategy { fn is(&self, _path: &Path) -> bool { self.is_match } |