Skip to content

Commit f2f3c55

Browse files
committed
Don't exclude dirs that appear in project root parent path
1 parent fb971c3 commit f2f3c55

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

xtask/tests/tidy.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,11 @@ impl TidyDocs {
180180
}
181181

182182
fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool {
183-
let mut cur_path = p;
184-
while let Some(path) = cur_path.parent() {
185-
if dirs_to_exclude.iter().any(|dir| path.ends_with(dir)) {
186-
return true;
187-
}
188-
cur_path = path;
189-
}
190-
191-
false
183+
p.strip_prefix(project_root())
184+
.unwrap()
185+
.components()
186+
.rev()
187+
.skip(1)
188+
.filter_map(|it| it.as_os_str().to_str())
189+
.any(|it| dirs_to_exclude.contains(&it))
192190
}

0 commit comments

Comments
 (0)