Only filter out target if its in the package root

This commit is contained in:
Lin Yihai 2023-11-09 13:55:48 +08:00
parent 1d8980511e
commit eebed13f46

View File

@ -327,7 +327,12 @@ impl<'cfg> PathSource<'cfg> {
match file_path.file_name().and_then(|s| s.to_str()) {
// The `target` directory is never included.
Some("target") => continue,
Some("target") => {
// Only filter out target if its in the package root.
if file_path.parent().unwrap() == pkg_path {
continue;
}
}
// Keep track of all sub-packages found and also strip out all
// matches we've found so far. Note, though, that if we find