Skip to content

Commit f08db6c

Browse files
committed
Fix max-depth and depth interpretation
1 parent 1b0bddb commit f08db6c

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
name = "nomino"
99
readme = "README.md"
1010
repository = "https://github.com/yaa110/nomino"
11-
version = "1.0.0"
11+
version = "1.0.1"
1212

1313
[dependencies]
1414
atty = "0.2"

src/input/iterator.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,14 @@ impl InputIterator {
6161
}
6262

6363
if let Source::Regex(re, depth, max_depth) = source {
64-
let depth = if let Some(max_depth) = max_depth {
65-
if max_depth < depth {
66-
max_depth
67-
} else {
68-
depth
69-
}
70-
} else {
71-
depth
72-
};
64+
let max_depth = max_depth.unwrap_or(depth);
7365
return Ok(Self::DirectoryIterator {
7466
formatter,
7567
re,
7668
preserve_extension,
7769
iter: WalkDir::new(".")
78-
.min_depth(depth)
79-
.max_depth(depth)
70+
.min_depth(if depth > max_depth { max_depth } else { depth })
71+
.max_depth(max_depth)
8072
.into_iter(),
8173
});
8274
}

0 commit comments

Comments
 (0)