Port calls to slices.Sort functions since they now need a cmp() function rather than a less() function

Also rename os.SEEK_* to io.Seek* as the former has been deprecated
This commit is contained in:
Kovid Goyal
2023-08-04 22:50:13 +05:30
parent 18d48c8dcd
commit 341d845b9a
18 changed files with 60 additions and 34 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"testing"
"kitty/tools/utils"
@@ -42,8 +43,8 @@ func TestDiffCollectWalk(t *testing.T) {
t.Fatal(err)
}
if diff := cmp.Diff(
utils.Sort(expected_names.AsSlice(), func(a, b string) bool { return a < b }),
utils.Sort(names.AsSlice(), func(a, b string) bool { return a < b }),
utils.Sort(expected_names.AsSlice(), strings.Compare),
utils.Sort(names.AsSlice(), strings.Compare),
); diff != "" {
t.Fatal(diff)
}

View File

@@ -124,7 +124,7 @@ func (self *Search) search(logical_lines *LogicalLines) {
}
})
for _, spans := range self.matches {
slices.SortFunc(spans, func(a, b Span) bool { return a.start < b.start })
slices.SortFunc(spans, func(a, b Span) int { return a.start - b.start })
}
}