mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Use slices package from the stdlib when possible (#5360)
* Use slices from the stdlib when possible * Add some unit tests * More small tweaks + add benchmark func
This commit is contained in:
@@ -33,8 +33,8 @@ func FromString(s string, sep string) []string {
|
||||
// Unique returns a slice containing only unique values from the provided slice.
|
||||
// The comparison is case-insensitive.
|
||||
func UniqueFold(s []string) []string {
|
||||
seen := make(map[string]struct{})
|
||||
var ret []string
|
||||
seen := make(map[string]struct{}, len(s))
|
||||
ret := make([]string, 0, len(s))
|
||||
for _, v := range s {
|
||||
if _, exists := seen[strings.ToLower(v)]; exists {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user