Skip to content

Commit

Permalink
locode-db: use for range integers
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Butusov <andrey@nspcc.io>
  • Loading branch information
End-rey committed Aug 23, 2024
1 parent 5132646 commit bd2276d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/parsers/db/coordinates.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (lc *LatitudeCode) Degrees() (l [latDegDigits]uint8) {
}

func (cc *coordinateCode) minutes() (mnt [minutesDigits]uint8) {
for i := 0; i < minutesDigits; i++ {
for i := range minutesDigits {
mnt[i] = cc.value[cc.degDigits+i]
}

Expand Down Expand Up @@ -135,7 +135,7 @@ func (lc *LatitudeCode) Hemisphere() LatitudeHemisphere {
}

func (cc *coordinateCode) hemisphere() (h [hemisphereSymbols]uint8) {
for i := 0; i < hemisphereSymbols; i++ {
for i := range hemisphereSymbols {
h[i] = cc.value[cc.degDigits+minutesDigits+i]
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/locodedb/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
func BenchmarkUnpack(b *testing.B) {
require.NotEmpty(b, testCountriesData)
require.NotEmpty(b, testLocodesData)
for i := 0; i < b.N; i++ {
for range b.N {
m, err := unpackCountriesData(testCountriesData)
require.NoError(b, err)
_, err = unpackLocodesData(testLocodesData, m)
Expand All @@ -34,7 +34,7 @@ func BenchmarkGet(b *testing.B) {
_, err := Get("RU MOW")
require.NoError(b, err)
b.ResetTimer()
for i := 0; i < b.N; i++ {
for range b.N {
_, _ = Get("RU MOW")
_, _ = Get("AAAAA")
_, _ = Get("SESTO")
Expand Down

0 comments on commit bd2276d

Please sign in to comment.