diff --git a/cuckoo_fuzz_test.go b/cuckoo_fuzz_test.go index f96bc6e..a6a5672 100644 --- a/cuckoo_fuzz_test.go +++ b/cuckoo_fuzz_test.go @@ -77,7 +77,7 @@ func FuzzInsertLookup(f *testing.F) { _, ok = actual.Get(step.key) assert.False(ok) } else { - _, err := actual.Put(step.key, step.value) + err := actual.Put(step.key, step.value) assert.NoError(err) expected[step.key] = step.value diff --git a/cuckoo_internal_test.go b/cuckoo_internal_test.go index d34852a..461f4d7 100644 --- a/cuckoo_internal_test.go +++ b/cuckoo_internal_test.go @@ -23,7 +23,7 @@ func TestLoad(t *testing.T) { table := New[int, bool](Capacity(8)) for i := range 16 { - _, err := table.Put(i, true) + err := table.Put(i, true) assert.NoError(err) assert.Equal(float64(table.Size())/float64(table.TotalCapacity()), table.load()) } diff --git a/cuckoo_test.go b/cuckoo_test.go index d0d1ae3..08394ad 100644 --- a/cuckoo_test.go +++ b/cuckoo_test.go @@ -25,7 +25,7 @@ func TestAddItem(t *testing.T) { key, value := 0, true table := cuckoo.New[int, bool]() - _, err := table.Put(key, value) + err := table.Put(key, value) assert.NoError(err) assert.Equal(1, table.Size()) @@ -38,7 +38,7 @@ func TestPutOverwrite(t *testing.T) { table := cuckoo.New[int, int]() (table.Put(key, value)) - _, err := table.Put(key, newValue) + err := table.Put(key, newValue) assert.NoError(err) assert.Equal(1, table.Size()) @@ -52,9 +52,9 @@ func TestSameHash(t *testing.T) { hash := func(int) uint64 { return 0 } table := cuckoo.NewCustom[int, bool](hash, hash, cuckoo.DefaultEqualFunc[int]) - _, errA := table.Put(0, true) - _, errB := table.Put(1, true) - _, errC := table.Put(2, true) + errA := table.Put(0, true) + errB := table.Put(1, true) + errC := table.Put(2, true) assert.NoError(errA) assert.NoError(errB) @@ -76,7 +76,7 @@ func TestResizeCapacity(t *testing.T) { ) for table.TotalCapacity() == 16 { - _, err := table.Put(rand.Int(), true) + err := table.Put(rand.Int(), true) assert.NoError(err) } @@ -89,7 +89,7 @@ func TestPutMany(t *testing.T) { for i := range 1_000 { expected[i] = true - _, err := actual.Put(i, true) + err := actual.Put(i, true) assert.NoError(err) } @@ -103,7 +103,7 @@ func TestGetMany(t *testing.T) { table := cuckoo.New[int, bool]() for i := range 1_000 { - _, err := table.Put(i, true) + err := table.Put(i, true) assert.NoError(err) } @@ -167,7 +167,7 @@ func TestPutNoCapacity(t *testing.T) { cuckoo.Capacity(0), ) - _, err := table.Put(key, value) + err := table.Put(key, value) assert.NoError(err) assert.Equal(1, table.Size()) @@ -183,9 +183,9 @@ func TestBadHashCapacity(t *testing.T) { cuckoo.Capacity(20), ) - _, err1 := table.Put(0, true) - _, err2 := table.Put(1, true) - _, err3 := table.Put(2, true) + err1 := table.Put(0, true) + err2 := table.Put(1, true) + err3 := table.Put(2, true) assert.NoError(err1) assert.NoError(err2) @@ -200,8 +200,8 @@ func TestDropResizeCapacity(t *testing.T) { cuckoo.Capacity(10), ) - _, err1 := table.Put(0, true) - _, err2 := table.Put(1, true) + err1 := table.Put(0, true) + err2 := table.Put(1, true) table.Drop(1) assert.NoError(errors.Join(err1, err2)) @@ -218,7 +218,7 @@ func TestNewTableBy(t *testing.T) { assert := assert.New(t) table := cuckoo.NewBy[User, bool](func(u User) string { return u.id }) - _, err := table.Put(User{nil, "1", "Robert"}, true) + err := table.Put(User{nil, "1", "Robert"}, true) assert.NoError(err) assert.Equal(1, table.Size()) diff --git a/doc_example_test.go b/doc_example_test.go index 63ea8f1..3671857 100644 --- a/doc_example_test.go +++ b/doc_example_test.go @@ -10,7 +10,7 @@ import ( func Example_basic() { table := cuckoo.New[int, string]() - if _, err := table.Put(1, "Hello, World!"); err != nil { + if err := table.Put(1, "Hello, World!"); err != nil { fmt.Println("Put error:", err) }