Skip to content

Commit

Permalink
fix bug in SortedFromMap (eschew maps package)
Browse files Browse the repository at this point in the history
  • Loading branch information
jub0bs committed Nov 15, 2024
1 parent c4c1a2d commit f013595
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package iterutil
import (
"cmp"
"iter"
"maps"
"slices"

"golang.org/x/exp/constraints"
Expand Down Expand Up @@ -101,7 +100,7 @@ func SortedFromMap[M ~map[K]V, K cmp.Ordered, V any](m M) iter.Seq2[K, V] {
// See https://github.com/golang/go/issues/61899#issuecomment-2198727055.
ks := keys(m)
slices.Sort(ks)
for _, k := range slices.Sorted(maps.Keys(m)) {
for _, k := range ks {
if !yield(k, m[k]) {
return
}
Expand Down

0 comments on commit f013595

Please sign in to comment.