From 749297652ccb4136dce22a8a50a2429bed908a04 Mon Sep 17 00:00:00 2001 From: makki_d Date: Wed, 4 Sep 2024 01:29:13 +0900 Subject: [PATCH] optimize on error --- iter.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/iter.go b/iter.go index 96ae0ad..c616d33 100644 --- a/iter.go +++ b/iter.go @@ -20,13 +20,11 @@ func iterAll[T any, E Enumerator[T]](e E) iter.Seq2[T, error] { if isEOC(err) { return } - } - - if !yield(v, err) { + yield(v, err) return } - if err != nil { + if !yield(v, nil) { return } }