Skip to content

Commit c29175f

Browse files
bors[bot]Veetaha
andauthored
Merge #4715
4715: Don't exclude dirs that appear in project root parent path r=matklad a=Veetaha Co-authored-by: veetaha <veetaha2@gmail.com>
2 parents 68f26dc + f2f3c55 commit c29175f

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)