mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 09:12:28 +08:00
refactor: code improvement, ToString, Contain, Compact
This commit is contained in:
@@ -61,7 +61,6 @@ func Compact[T comparable](slice []T) []T {
|
|||||||
var zero T
|
var zero T
|
||||||
|
|
||||||
result := []T{}
|
result := []T{}
|
||||||
|
|
||||||
for _, item := range slice {
|
for _, item := range slice {
|
||||||
if item != zero {
|
if item != zero {
|
||||||
result = append(result, item)
|
result = append(result, item)
|
||||||
|
|||||||
Reference in New Issue
Block a user