From 290db00010709c85e5d1a93f1bfe348a93cb9421 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 30 Oct 2023 09:48:25 +0100 Subject: [PATCH] Return directly instead of setting variable Fixes #4 --- version.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/version.go b/version.go index bde285e..46c98af 100644 --- a/version.go +++ b/version.go @@ -2825,17 +2825,11 @@ func chooseQRCodeVersion(level RecoveryLevel, encoder *dataEncoder, numDataBits func (v qrCodeVersion) numTerminatorBitsRequired(numDataBits int) int { numFreeBits := v.numDataBits() - numDataBits - - var numTerminatorBits int - - switch { - case numFreeBits >= 4: - numTerminatorBits = 4 - default: - numTerminatorBits = numFreeBits + if numFreeBits >= 4 { + return 4 } - return numTerminatorBits + return numDataBits } // numBlocks returns the number of blocks.