chore: sort.Slice → slices.SortFunc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude 2026-02-24 16:29:48 +00:00
parent 9f6dd9d4eb
commit 694e78ca34
No known key found for this signature in database
GPG key ID: AF404715446AEB41
2 changed files with 7 additions and 7 deletions

View file

@ -3,11 +3,11 @@
package metal
import (
"cmp"
"context"
"fmt"
"math"
"slices"
"sort"
"time"
)
@ -49,8 +49,8 @@ func (m *Model) Classify(ctx context.Context, prompts []string, cfg GenerateConf
for i := range indices {
indices[i] = i
}
sort.Slice(indices, func(a, b int) bool {
return lengths[indices[a]] > lengths[indices[b]]
slices.SortFunc(indices, func(a, b int) int {
return cmp.Compare(lengths[b], lengths[a])
})
maxLen := lengths[indices[0]]
@ -160,8 +160,8 @@ func (m *Model) BatchGenerate(ctx context.Context, prompts []string, cfg Generat
for i := range indices {
indices[i] = i
}
sort.Slice(indices, func(a, b int) bool {
return lengths[indices[a]] > lengths[indices[b]]
slices.SortFunc(indices, func(a, b int) int {
return cmp.Compare(lengths[b], lengths[a])
})
N := int32(len(prompts))

View file

@ -15,7 +15,7 @@ import (
"math"
"os"
"path/filepath"
"sort"
"slices"
"strings"
"unsafe"
)
@ -156,7 +156,7 @@ func (a *LoRAAdapter) SortedNames() []string {
for name := range a.Layers {
names = append(names, name)
}
sort.Strings(names)
slices.Sort(names)
return names
}