Skip to content

Commit b5ee80a

Browse files
tklausergopherbot
authored andcommitted
sort: drop implementation for Go <1.21
Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156), the fallback implementation for Go versions <1.21 can be dropped. For #61180 For #64751 Change-Id: Idfeca0a6e9f490e1ab0f308ead372612402923ea Reviewed-on: https://go-review.googlesource.com/c/go/+/607315 Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Commit-Queue: Tobias Klauser <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Tobias Klauser <[email protected]>
1 parent 440c9ee commit b5ee80a

File tree

3 files changed

+10
-44
lines changed

3 files changed

+10
-44
lines changed

src/sort/sort.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
// Package sort provides primitives for sorting slices and user-defined collections.
88
package sort
99

10-
import "math/bits"
10+
import (
11+
"math/bits"
12+
"slices"
13+
)
1114

1215
// An implementation of Interface can be sorted by the routines in this package.
1316
// The methods refer to elements of the underlying collection by integer index.
@@ -162,34 +165,34 @@ func (x StringSlice) Sort() { Sort(x) }
162165
// Ints sorts a slice of ints in increasing order.
163166
//
164167
// Note: as of Go 1.22, this function simply calls [slices.Sort].
165-
func Ints(x []int) { intsImpl(x) }
168+
func Ints(x []int) { slices.Sort(x) }
166169

167170
// Float64s sorts a slice of float64s in increasing order.
168171
// Not-a-number (NaN) values are ordered before other values.
169172
//
170173
// Note: as of Go 1.22, this function simply calls [slices.Sort].
171-
func Float64s(x []float64) { float64sImpl(x) }
174+
func Float64s(x []float64) { slices.Sort(x) }
172175

173176
// Strings sorts a slice of strings in increasing order.
174177
//
175178
// Note: as of Go 1.22, this function simply calls [slices.Sort].
176-
func Strings(x []string) { stringsImpl(x) }
179+
func Strings(x []string) { slices.Sort(x) }
177180

178181
// IntsAreSorted reports whether the slice x is sorted in increasing order.
179182
//
180183
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
181-
func IntsAreSorted(x []int) bool { return intsAreSortedImpl(x) }
184+
func IntsAreSorted(x []int) bool { return slices.IsSorted(x) }
182185

183186
// Float64sAreSorted reports whether the slice x is sorted in increasing order,
184187
// with not-a-number (NaN) values before any other values.
185188
//
186189
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
187-
func Float64sAreSorted(x []float64) bool { return float64sAreSortedImpl(x) }
190+
func Float64sAreSorted(x []float64) bool { return slices.IsSorted(x) }
188191

189192
// StringsAreSorted reports whether the slice x is sorted in increasing order.
190193
//
191194
// Note: as of Go 1.22, this function simply calls [slices.IsSorted].
192-
func StringsAreSorted(x []string) bool { return stringsAreSortedImpl(x) }
195+
func StringsAreSorted(x []string) bool { return slices.IsSorted(x) }
193196

194197
// Notes on stable sorting:
195198
// The used algorithms are simple and provable correct on all input and use

src/sort/sort_impl_120.go

-15
This file was deleted.

src/sort/sort_impl_go121.go

-22
This file was deleted.

0 commit comments

Comments
 (0)