chore: simplify struct initialization to direct return

Christian Rocha created

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>

Change summary

internal/pubsub/broker.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Detailed changes

internal/pubsub/broker.go 🔗

@@ -20,12 +20,11 @@ func NewBroker[T any]() *Broker[T] {
 }
 
 func NewBrokerWithOptions[T any](channelBufferSize, maxEvents int) *Broker[T] {
-	b := &Broker[T]{
+	return &Broker[T]{
 		subs:      make(map[chan Event[T]]struct{}),
 		done:      make(chan struct{}),
 		maxEvents: maxEvents,
 	}
-	return b
 }
 
 func (b *Broker[T]) Shutdown() {