rust: no alocar por archivos que no se van a comprimir
This commit is contained in:
parent
bade1e4913
commit
1f60324e83
1 changed files with 2 additions and 2 deletions
|
@ -121,15 +121,15 @@ fn iterator(input: &Path) -> impl Iterator<Item = PathBuf> {
|
|||
.into_iter()
|
||||
.filter_map(|e| e.ok())
|
||||
.filter(|e| e.file_type().is_file())
|
||||
.filter(|e| !already_compressed(e.path()))
|
||||
.map(|e| e.path().to_owned())
|
||||
.filter(|e| !already_compressed(e))
|
||||
}
|
||||
|
||||
fn strip_input(path: &Path, input: &Path) -> PathBuf {
|
||||
path.strip_prefix(input).unwrap().to_owned()
|
||||
}
|
||||
|
||||
fn already_compressed(path: &PathBuf) -> bool {
|
||||
fn already_compressed(path: &Path) -> bool {
|
||||
let p = path.to_string_lossy();
|
||||
p.ends_with(".br") || p.ends_with(".gz")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue