event, event/filter: minor code cleanup (#18061)

This commit is contained in:
Corey Lin 2018-11-08 19:17:01 +08:00 committed by Felix Lange
parent 503993c819
commit 968f6019d0
2 changed files with 6 additions and 6 deletions

@ -141,7 +141,7 @@ func TestMuxConcurrent(t *testing.T) {
} }
} }
func emptySubscriber(mux *TypeMux, types ...interface{}) { func emptySubscriber(mux *TypeMux) {
s := mux.Subscribe(testEvent(0)) s := mux.Subscribe(testEvent(0))
go func() { go func() {
for range s.Chan() { for range s.Chan() {
@ -182,9 +182,9 @@ func BenchmarkPost1000(b *testing.B) {
func BenchmarkPostConcurrent(b *testing.B) { func BenchmarkPostConcurrent(b *testing.B) {
var mux = new(TypeMux) var mux = new(TypeMux)
defer mux.Stop() defer mux.Stop()
emptySubscriber(mux, testEvent(0)) emptySubscriber(mux)
emptySubscriber(mux, testEvent(0)) emptySubscriber(mux)
emptySubscriber(mux, testEvent(0)) emptySubscriber(mux)
var wg sync.WaitGroup var wg sync.WaitGroup
poster := func() { poster := func() {

@ -25,7 +25,7 @@ type Generic struct {
// self = registered, f = incoming // self = registered, f = incoming
func (self Generic) Compare(f Filter) bool { func (self Generic) Compare(f Filter) bool {
var strMatch, dataMatch = true, true var strMatch = true
filter := f.(Generic) filter := f.(Generic)
if (len(self.Str1) > 0 && filter.Str1 != self.Str1) || 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{}) { func (self Generic) Trigger(data interface{}) {