Skip to content

Commit

Permalink
Avoid shadowing variable (#263)
Browse files Browse the repository at this point in the history
Rename the shadowed variable i to j for better readability.
  • Loading branch information
dsnet committed May 27, 2021
1 parent 248ccff commit 290a6a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmp/report_slices.go
Expand Up @@ -563,10 +563,10 @@ func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []d
nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified
ny := ds.NumIdentical + ds.NumInserted + ds.NumModified
var numLeadingIdentical, numTrailingIdentical int
for i := 0; i < nx && i < ny && eq(ix+i, iy+i); i++ {
for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ {
numLeadingIdentical++
}
for i := 0; i < nx && i < ny && eq(ix+nx-1-i, iy+ny-1-i); i++ {
for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ {
numTrailingIdentical++
}
if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 {
Expand Down

0 comments on commit 290a6a2

Please sign in to comment.