From faf75185ae921455d8a87f40064117548facc572 Mon Sep 17 00:00:00 2001 From: milarin Date: Thu, 4 Apr 2024 19:11:33 +0200 Subject: [PATCH] refactor --- result.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/result.go b/result.go index cb1fa71..2eb2fed 100644 --- a/result.go +++ b/result.go @@ -64,7 +64,7 @@ func (r Result[T]) Err() error { } func FilterSuccess[T any](source <-chan Result[T]) <-chan T { - succeeded := Filter(source, func(r Result[T]) bool { return r.Success() }) + succeeded := Filter(source, Result[T].Success) return MapSuccessive(succeeded, func(r Result[T]) T { v, _ := r.Get() @@ -73,7 +73,7 @@ func FilterSuccess[T any](source <-chan Result[T]) <-chan T { } func FilterFail[T any](source <-chan Result[T]) <-chan T { - failed := Filter(source, func(r Result[T]) bool { return r.Fail() }) + failed := Filter(source, Result[T].Fail) return MapSuccessive(failed, func(r Result[T]) T { v, _ := r.Get() @@ -94,7 +94,7 @@ func FilterResults[T any](source <-chan Result[T]) (succeeded <-chan T, failed < fail <- r.Err() continue } - succ <- r.GetSafe() + succ <- r.GetUnsafe() } }()