Remove an unnecessary code branch

This commit is contained in:
Junegunn Choi 2017-08-26 20:09:46 +09:00
parent af809c9661
commit 159699b5d7
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -384,21 +384,18 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util.
var class charClass var class charClass
if char <= unicode.MaxASCII { if char <= unicode.MaxASCII {
class = charClassOfAscii(char) class = charClassOfAscii(char)
if !caseSensitive && class == charUpper {
char += 32
}
} else { } else {
class = charClassOfNonAscii(char) class = charClassOfNonAscii(char)
}
if !caseSensitive && class == charUpper { if !caseSensitive && class == charUpper {
if char <= unicode.MaxASCII {
char += 32
} else {
char = unicode.To(unicode.LowerCase, char) char = unicode.To(unicode.LowerCase, char)
} }
}
if normalize { if normalize {
char = normalizeRune(char) char = normalizeRune(char)
} }
}
Tsub[off] = char Tsub[off] = char
bonus := bonusFor(prevClass, class) bonus := bonusFor(prevClass, class)