Skip to content

Commit

Permalink
Fix ineffectual assignment to lastLineIdx
Browse files Browse the repository at this point in the history
Please review this thoroughly, I'm not sure I can properly test this change.
However I noticed that the assignment to lastLineIdx in line 93 is ineffectual,
as it'll always get overwritten in the line below. I can only assume this
either means the else-block was missing (which is what I'm fixing here), or it's
an old check that's just lingering around and was forgotten to be removed during
refactoring.
  • Loading branch information
muesli committed Jul 20, 2019
1 parent 1b31600 commit a3f2e44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmp/report_slices.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
if r == '\n' {
if maxLineLen < i-lastLineIdx {
lastLineIdx = i - lastLineIdx
} else {
lastLineIdx = i + 1
}
lastLineIdx = i + 1
numLines++
}
}
Expand Down

0 comments on commit a3f2e44

Please sign in to comment.