Skip to content

Commit f6c64f8

Browse files
author
Stephan Dilly
committed
cleanup
1 parent 1a930db commit f6c64f8

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

asyncgit/src/sync/commit_files.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@ pub fn get_commit_files(
2323
get_commit_diff(&repo, id, None)?
2424
};
2525

26-
let mut res = Vec::with_capacity(diff.deltas().count());
27-
28-
for delta in diff.deltas() {
29-
let status = StatusItemType::from(delta.status());
30-
31-
res.push(StatusItem {
32-
path: delta
33-
.new_file()
34-
.path()
35-
.map(|p| p.to_str().unwrap_or("").to_string())
36-
.unwrap_or_default(),
37-
status,
38-
});
39-
}
26+
let res = diff
27+
.deltas()
28+
.map(|delta| {
29+
let status = StatusItemType::from(delta.status());
30+
31+
StatusItem {
32+
path: delta
33+
.new_file()
34+
.path()
35+
.map(|p| p.to_str().unwrap_or("").to_string())
36+
.unwrap_or_default(),
37+
status,
38+
}
39+
})
40+
.collect::<Vec<_>>();
4041

4142
Ok(res)
4243
}

0 commit comments

Comments
 (0)