fix: dx check now respects files to ignore (e.g. .gitignore) (#4038)

closes #3751
This commit is contained in:
silentvoid authored and GitHub committed 2025-04-25 08:37:39 -05:00
1 parent 6733e43cc2
commit 74789c4b13
3 files changed
+19 -44

No files matched your search

+15
View File
@@ -2,6 +2,7 @@
use std::error::Error;
use std::{
env,
ffi::OsStr,
fmt::{Display, Formatter},
fs,
path::{Path, PathBuf},
@@ -62,3 +63,17 @@ fn contains_manifest(path: &Path) -> bool {
})
.unwrap_or(false)
}
/// Collects all `.rs` files in the provided directory, respecting files to ignore (e.g. `.gitignore`)
pub(crate) fn collect_rs_files(dir: impl AsRef<Path>) -> Vec<PathBuf> {
let mut files = Vec::new();
for result in ignore::Walk::new(dir) {
let path = result.unwrap().into_path();
if let Some(ext) = path.extension() {
if ext == OsStr::new("rs") {
files.push(path);
}
}
}
files
}