Skip to content

Commit 2ebfac8

Browse files
committed
fn: fix linter issue
1 parent 4d50f19 commit 2ebfac8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fn/iter.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ func Enumerate[T any](items []T, f func(int, T)) {
3838
}
3939
}
4040

41-
// MakeSlice is a generic function short hand for making a slice out of a set
41+
// MakeSlice is a generic function shorthand for making a slice out of a set
4242
// of elements. This can be used to avoid having to specify the type of the
4343
// slice as well as the types of the elements.
4444
func MakeSlice[T any](items ...T) []T {
4545
ts := make([]T, len(items))
46-
for i, item := range items {
47-
ts[i] = item
48-
}
46+
copy(ts, items)
4947

5048
return ts
5149
}

0 commit comments

Comments
 (0)