4715: Don't exclude dirs that appear in project root parent path r=matklad a=Veetaha



Co-authored-by: veetaha <veetaha2@gmail.com>
This commit is contained in:
bors[bot] 2020-06-03 07:15:18 +00:00 committed by GitHub
commit c29175f1ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,13 +180,11 @@ impl TidyDocs {
} }
fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool { fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool {
let mut cur_path = p; p.strip_prefix(project_root())
while let Some(path) = cur_path.parent() { .unwrap()
if dirs_to_exclude.iter().any(|dir| path.ends_with(dir)) { .components()
return true; .rev()
} .skip(1)
cur_path = path; .filter_map(|it| it.as_os_str().to_str())
} .any(|it| dirs_to_exclude.contains(&it))
false
} }