mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 19:12:50 +00:00
Use Iterator methods
This commit is contained in:
parent
ed46a777c8
commit
6b3811a358
@ -271,13 +271,7 @@ impl IgnoreList {
|
||||
}
|
||||
|
||||
fn skip_file_inner(&self, file: &Path) -> bool {
|
||||
for path in &self.0 {
|
||||
if file.starts_with(path) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
self.0.iter().any(|path| file.starts_with(path))
|
||||
}
|
||||
|
||||
pub fn skip_file(&self, file: &FileName) -> bool {
|
||||
|
@ -32,16 +32,7 @@ fn prune_files(files: Vec<&str>) -> Vec<&str> {
|
||||
|
||||
let mut pruned_prefixes = vec![];
|
||||
for p1 in prefixes {
|
||||
let mut include = true;
|
||||
if !p1.starts_with("src/bin/") {
|
||||
for p2 in &pruned_prefixes {
|
||||
if p1.starts_with(p2) {
|
||||
include = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if include {
|
||||
if p1.starts_with("src/bin/") || pruned_prefixes.iter().all(|p2| !p1.starts_with(p2)) {
|
||||
pruned_prefixes.push(p1);
|
||||
}
|
||||
}
|
||||
@ -50,17 +41,10 @@ fn prune_files(files: Vec<&str>) -> Vec<&str> {
|
||||
files
|
||||
.into_iter()
|
||||
.filter(|f| {
|
||||
let mut include = true;
|
||||
if f.ends_with("mod.rs") || f.ends_with("lib.rs") || f.starts_with("src/bin/") {
|
||||
return true;
|
||||
}
|
||||
for pp in &pruned_prefixes {
|
||||
if f.starts_with(pp) {
|
||||
include = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
include
|
||||
pruned_prefixes.iter().all(|pp| !f.starts_with(pp))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user