Skip to content

Commit

Permalink
perf: less allocations while validating files specified by a path. No…
Browse files Browse the repository at this point in the history
…w we dont allocate memory for each path matched criteria
  • Loading branch information
aegoroff committed Feb 20, 2025
1 parent 7fc3fcc commit 2eebf05
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ pub fn validate_all<V: ValidationFormatter, E: Errorer>(
.filter(|f| f.file_type().is_file())
.map(|f| f.path())
.filter(|p| p.ends_with(EDITOR_CONFIG))
.map(|f| f.to_str().unwrap_or("").to_string())
.inspect(|p| validate_one(p, formatter, err))
.inspect(|p| {
if let Some(p) = p.to_str() {
validate_one(p, formatter, err)
}
})
.count()
}

Expand Down

0 comments on commit 2eebf05

Please sign in to comment.