Skip to content

Commit e3e3211

Browse files
committed
refactor (#470)
1 parent cb53324 commit e3e3211

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

gitoxide-core/src/hours.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -204,29 +204,29 @@ where
204204
if entry_mode.is_no_tree() {
205205
files.modified += 1;
206206
}
207-
if line_stats {
208-
if let Some(Ok(diff)) = change.event.diff() {
209-
use git::diff::lines::similar::ChangeTag::*;
210-
let mut nl = 0;
211-
for change in diff
212-
.text(git::diff::lines::Algorithm::Myers)
213-
.iter_all_changes()
214-
{
215-
match change.tag() {
216-
Delete => {
217-
lines.removed += 1;
218-
nl += 1;
219-
}
220-
Insert => {
221-
lines.added += 1;
222-
nl += 1
223-
}
224-
Equal => {}
207+
if let Some(Ok(diff)) =
208+
line_stats.then(|| change.event.diff()).flatten()
209+
{
210+
use git::diff::lines::similar::ChangeTag::*;
211+
let mut nl = 0;
212+
for change in diff
213+
.text(git::diff::lines::Algorithm::Myers)
214+
.iter_all_changes()
215+
{
216+
match change.tag() {
217+
Delete => {
218+
lines.removed += 1;
219+
nl += 1;
225220
}
221+
Insert => {
222+
lines.added += 1;
223+
nl += 1
224+
}
225+
Equal => {}
226226
}
227-
if let Some(c) = lines_counter.as_ref() {
228-
c.fetch_add(nl, Ordering::SeqCst);
229-
}
227+
}
228+
if let Some(c) = lines_counter.as_ref() {
229+
c.fetch_add(nl, Ordering::SeqCst);
230230
}
231231
}
232232
}

0 commit comments

Comments
 (0)