Review feedback

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
Cyril Tovena 2021-10-11 13:59:24 +02:00
parent c8dfba9fa4
commit 01187fbce2
No known key found for this signature in database
GPG key ID: FD8F768F9D633FB6

View file

@ -322,9 +322,9 @@ func stringMatcherFromRegexp(re *syntax.Regexp) StringMatcher {
} }
// findSetMatches will returns only literals that are case sensitive. // findSetMatches will returns only literals that are case sensitive.
matches := findSetMatches(re, "") matches := findSetMatches(re, "")
if left == nil && right == nil { if left == nil && right == nil && len(matches) > 0 {
// if there's no any matchers on both side it's a concat of literals // if there's no any matchers on both side it's a concat of literals
if len(matches) > 0 {
or := make([]StringMatcher, 0, len(matches)) or := make([]StringMatcher, 0, len(matches))
for _, match := range matches { for _, match := range matches {
or = append(or, &equalStringMatcher{ or = append(or, &equalStringMatcher{
@ -334,7 +334,6 @@ func stringMatcherFromRegexp(re *syntax.Regexp) StringMatcher {
} }
return orStringMatcher(or) return orStringMatcher(or)
} }
}
// others we found literals in the middle. // others we found literals in the middle.
if len(matches) > 0 { if len(matches) > 0 {
return &containsStringMatcher{ return &containsStringMatcher{