summaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/slices/slices.go
blob: a0adcf4926bbc0023e39cdb16d46d6947518195b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// TODO: Replace with slices package when it lands in standard library.

package slices

// Clip removes unused capacity from the slice, returning s[:len(s):len(s)].
func Clip[S ~[]E, E any](s S) S {
	return s[:len(s):len(s)]
}