Skip to content

Commit cac5af2

Browse files
committed
Replace enumerate by zip to avoid cast
1 parent 2d19568 commit cac5af2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

asyncgit/src/sync/diff.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,11 @@ impl ConsumeHunk for FileDiff {
227227
) -> std::io::Result<()> {
228228
let lines = hunk
229229
.lines()
230-
.enumerate()
231-
.map(|(index, line)| DiffLine {
230+
.zip(0..)
231+
.map(|(line, index)| DiffLine {
232232
position: DiffLinePosition {
233-
old_lineno: Some(
234-
before_hunk_start + index as u32,
235-
),
236-
new_lineno: Some(after_hunk_start + index as u32),
233+
old_lineno: Some(before_hunk_start + index),
234+
new_lineno: Some(after_hunk_start + index),
237235
},
238236
content: String::from_utf8_lossy(line)
239237
.trim_matches(is_newline)

0 commit comments

Comments
 (0)