Skip to content

Commit b4895f7

Browse files
authored
Fix some small issues that were flagged by upcoming lint checks. (golang#138)
1 parent b51e350 commit b4895f7

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

s2/cell_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,6 @@ func TestCellDistanceToEdge(t *testing.T) {
750750
expectedError = 3e-8
751751
} else if expectedMin.Radians() <= math.Pi/3 {
752752
expectedError = 1e-15
753-
} else {
754-
expectedError = 1e-12
755753
}
756754

757755
if !float64Near(expectedMin.Radians(), actualMin.Radians(), expectedError) {

s2/edge_distances.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ func updateEdgePairMinDistance(a0, a1, b0, b1 Point, minDist s1.ChordAngle) (s1.
336336
return 0, false
337337
}
338338
if CrossingSign(a0, a1, b0, b1) == Cross {
339-
minDist = 0
340339
return 0, true
341340
}
342341

s2/point.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ func (p Point) IsNormalizable() bool {
344344
func (p Point) EnsureNormalizable() Point {
345345
// TODO(rsned): Zero vector isn't normalizable, and we don't have DCHECK in Go.
346346
// What is the appropriate return value in this case? Is it {NaN, NaN, NaN}?
347-
if p == (Point{r3.Vector{0, 0, 0}}) {
347+
if p == (Point{r3.Vector{X: 0, Y: 0, Z: 0}}) {
348348
return p
349349
}
350350
if !p.IsNormalizable() {

s2/shapeindex.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,9 +1466,11 @@ func (s *ShapeIndex) absorbIndexCell(p *PaddedCell, iter *ShapeIndexIterator, ed
14661466
}
14671467

14681468
// Update the edge list and delete this cell from the index.
1469-
edges, newEdges = newEdges, edges
1469+
// TODO(rsned): Figure out best fix for this. Linters are
1470+
// flagging the swap because newEdges is no longer used after
1471+
// this.
1472+
edges, newEdges = newEdges, edges // nolint
14701473
delete(s.cellMap, p.id)
1471-
// TODO(roberts): delete from s.Cells
14721474
}
14731475

14741476
// testAllEdges calls the trackers testEdge on all edges from shapes that have interiors.

0 commit comments

Comments
 (0)