Make standard optional, allow empty src_disable, and add none/custom kinds

This commit is contained in:
peoplemiau1
2026-05-29 18:57:45 +03:00
parent 478d1ad0c5
commit 0587965283
2 changed files with 24 additions and 19 deletions

View File

@@ -37,9 +37,6 @@ pub fn collect_sources(
collect_sources_rec(root, extensions, &mut sources, exclude_dirs, include_paths)?;
}
sources.sort();
if sources.is_empty() {
return Err(format!("No source files found in {}", format_roots(roots)));
}
Ok(sources)
}
@@ -89,17 +86,6 @@ fn collect_sources_rec(
Ok(())
}
fn format_roots(roots: &[PathBuf]) -> String {
if roots.is_empty() {
return "<none>".to_string();
}
let mut out = Vec::new();
for root in roots {
out.push(root.to_string_lossy().to_string());
}
out.join(", ")
}
pub fn is_excluded(path: &Path, exclude_dirs: &[PathBuf], include_paths: &[String]) -> bool {
if matches_patterns(path, include_paths, true) {
return false;
@@ -624,7 +610,8 @@ mod tests {
let result = collect_sources(&roots, &["c"], &[], &include);
std::env::set_current_dir(prev).unwrap();
assert!(result.is_err(), "empty src should return error");
let sources = result.expect("empty src should return Ok");
assert!(sources.is_empty(), "empty src should return empty vec");
}
#[test]