refactor: replace min/max helpers with built-in min/max
We can use the built-in `min` and `max` functions since Go 1.21. Reference: https://go.dev/ref/spec#Min_and_max Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
7 files changed
+6
-116
No files matched your search
@@ -74,24 +74,6 @@ func (a *RangeIndex) addRange(start, end uint64) error {
|
||||
"than end height %d", start, end)
|
||||
}
|
||||
|
||||
// min is a helper closure that will return the minimum of two uint64s.
|
||||
min := func(a, b uint64) uint64 {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// max is a helper closure that will return the maximum of two uint64s.
|
||||
max := func(a, b uint64) uint64 {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// Collect the ranges that fall before and after the new range along
|
||||
// with the start and end values of the new range.
|
||||
var before, after []rangeItem
|
||||
|
||||
@@ -74,24 +74,6 @@ func (a *RangeIndex) addRange(start, end uint64) error {
|
||||
"than end height %d", start, end)
|
||||
}
|
||||
|
||||
// min is a helper closure that will return the minimum of two uint64s.
|
||||
min := func(a, b uint64) uint64 {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// max is a helper closure that will return the maximum of two uint64s.
|
||||
max := func(a, b uint64) uint64 {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// Collect the ranges that fall before and after the new range along
|
||||
// with the start and end values of the new range.
|
||||
var before, after []rangeItem
|
||||
|
||||
@@ -74,24 +74,6 @@ func (a *RangeIndex) addRange(start, end uint64) error {
|
||||
"than end height %d", start, end)
|
||||
}
|
||||
|
||||
// min is a helper closure that will return the minimum of two uint64s.
|
||||
min := func(a, b uint64) uint64 {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// max is a helper closure that will return the maximum of two uint64s.
|
||||
max := func(a, b uint64) uint64 {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
// Collect the ranges that fall before and after the new range along
|
||||
// with the start and end values of the new range.
|
||||
var before, after []rangeItem
|
||||
|
||||
Reference in new issue
Block a user