From d6ded4202637157b46da0e0a5f5f35d29ff39fcc Mon Sep 17 00:00:00 2001 From: Marcel Meyer Date: Sun, 21 Dec 2025 17:28:33 +0100 Subject: [PATCH] Replace nested max calls with single max --- src/algo/algo.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algo/algo.go b/src/algo/algo.go index 8e74ce1f..f9ce4df5 100644 --- a/src/algo/algo.go +++ b/src/algo/algo.go @@ -589,7 +589,7 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util. if b >= bonusBoundary && b > fb { consecutive = 1 } else { - b = max(b, max(bonusConsecutive, fb)) + b = max(b, bonusConsecutive, fb) } } if s1+b < s2 { @@ -602,7 +602,7 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util. Csub[off] = consecutive inGap = s1 < s2 - score := max(max(s1, s2), 0) + score := max(s1, s2, 0) if pidx == M-1 && (forward && score > maxScore || !forward && score >= maxScore) { maxScore, maxScorePos = score, col } @@ -686,7 +686,7 @@ func calculateScore(caseSensitive bool, normalize bool, text *util.Chars, patter if bonus >= bonusBoundary && bonus > firstBonus { firstBonus = bonus } - bonus = max(max(bonus, firstBonus), bonusConsecutive) + bonus = max(bonus, firstBonus, bonusConsecutive) } if pidx == 0 { score += int(bonus * bonusFirstCharMultiplier)