summaryrefslogtreecommitdiffstats
path: root/src/recipe.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-09-05 18:10:09 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-09-05 18:10:09 +0200
commit0cd848b90748bd2089587805df57cea5471372a6 (patch)
treebb73c1b7ca37c6f871a538b6b2e633ddb710fc5d /src/recipe.rs
parent8aee0bfe96b5604bd9b1276536b305a8b50c0a7a (diff)
downloadrebel-0cd848b90748bd2089587805df57cea5471372a6.tar
rebel-0cd848b90748bd2089587805df57cea5471372a6.zip
recipe: simplify directory walk code
Diffstat (limited to 'src/recipe.rs')
-rw-r--r--src/recipe.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/recipe.rs b/src/recipe.rs
index d5695f6..18f23fe 100644
--- a/src/recipe.rs
+++ b/src/recipe.rs
@@ -55,14 +55,12 @@ fn is_yml(path: &Path) -> bool {
pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<TaskMap> {
let mut ret = TaskMap::new();
- for entry in WalkDir::new(path)
- .into_iter()
- .filter_map(|e| e.ok())
- .filter(|e| {
- let path = e.path();
- path.is_file() && is_yml(path)
- }) {
+ for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
let path = entry.path();
+ if !path.is_file() || !is_yml(path) {
+ continue;
+ }
+
let basename = match path.file_stem().map(|n| n.to_str()) {
Some(Some(v)) => v,
_ => continue,