Skip to content

Commit 480f731

Browse files
committed
Minor reformats
1 parent a5d91e7 commit 480f731

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

it/filter_unique.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import "iter"
88
func FilterUnique[V comparable](iterator func(func(V) bool)) iter.Seq[V] {
99
return func(yield func(V) bool) {
1010
seen := make(map[V]struct{})
11+
1112
for value := range iterator {
1213
if _, ok := seen[value]; ok {
1314
continue

it/filter_unique_test.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package it_test
22

33
import (
44
"fmt"
5-
"github.com/BooleanCat/go-functional/v2/internal/assert"
6-
"github.com/BooleanCat/go-functional/v2/it"
75
"slices"
86
"testing"
7+
8+
"github.com/BooleanCat/go-functional/v2/internal/assert"
9+
"github.com/BooleanCat/go-functional/v2/it"
910
)
1011

1112
func ExampleFilterUnique() {
12-
for number := range it.FilterUnique(slices.Values([]int{1, 2, 2, 3, 3, 3, 4, 5})) {
13+
for number := range it.FilterUnique(slices.Values([]int{1, 2, 2, 3, 3, 3, 4})) {
1314
fmt.Println(number)
1415
}
1516

@@ -18,26 +19,22 @@ func ExampleFilterUnique() {
1819
// 2
1920
// 3
2021
// 4
21-
// 5
2222
}
2323

2424
func TestFilterUniqueEmpty(t *testing.T) {
2525
t.Parallel()
2626

27-
assert.Empty[int](t, slices.Collect(it.Chain[int]()))
27+
assert.Empty[int](t, slices.Collect(it.Exhausted[int]()))
2828
}
2929

3030
func TestFilterUniqueYieldFalse(t *testing.T) {
3131
t.Parallel()
3232

3333
iterator := it.FilterUnique(slices.Values([]int{100, 200, 300}))
3434

35-
var value int
3635
iterator(func(v int) bool {
37-
value = v
3836
return false
3937
})
40-
assert.Equal(t, 100, value)
4138
}
4239

4340
func TestFilterUniqueWithNoDuplicates(t *testing.T) {

0 commit comments

Comments
 (0)