From 968f6019d00e349e988f720cdaa065def85ea72f Mon Sep 17 00:00:00 2001 From: Corey Lin <514971757@qq.com> Date: Thu, 8 Nov 2018 19:17:01 +0800 Subject: [PATCH] event, event/filter: minor code cleanup (#18061) --- event/event_test.go | 8 ++++---- event/filter/generic_filter.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/event/event_test.go b/event/event_test.go index a12945a47..2be357ba2 100644 --- a/event/event_test.go +++ b/event/event_test.go @@ -141,7 +141,7 @@ func TestMuxConcurrent(t *testing.T) { } } -func emptySubscriber(mux *TypeMux, types ...interface{}) { +func emptySubscriber(mux *TypeMux) { s := mux.Subscribe(testEvent(0)) go func() { for range s.Chan() { @@ -182,9 +182,9 @@ func BenchmarkPost1000(b *testing.B) { func BenchmarkPostConcurrent(b *testing.B) { var mux = new(TypeMux) defer mux.Stop() - emptySubscriber(mux, testEvent(0)) - emptySubscriber(mux, testEvent(0)) - emptySubscriber(mux, testEvent(0)) + emptySubscriber(mux) + emptySubscriber(mux) + emptySubscriber(mux) var wg sync.WaitGroup poster := func() { diff --git a/event/filter/generic_filter.go b/event/filter/generic_filter.go index d679b8bfa..467bf01be 100644 --- a/event/filter/generic_filter.go +++ b/event/filter/generic_filter.go @@ -25,7 +25,7 @@ type Generic struct { // self = registered, f = incoming func (self Generic) Compare(f Filter) bool { - var strMatch, dataMatch = true, true + var strMatch = true filter := f.(Generic) if (len(self.Str1) > 0 && filter.Str1 != self.Str1) || @@ -40,7 +40,7 @@ func (self Generic) Compare(f Filter) bool { } } - return strMatch && dataMatch + return strMatch } func (self Generic) Trigger(data interface{}) {