aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golangci/misspell/replace.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-09-10 12:16:33 +0200
committerTaras Madan <tarasmadan@google.com>2024-09-10 14:05:26 +0000
commitc97c816133b42257d0bcf1ee4bd178bb2a7a2b9e (patch)
tree0bcbc2e540bbf8f62f6c17887cdd53b8c2cee637 /vendor/github.com/golangci/misspell/replace.go
parent54e657429ab892ad06c90cd7c1a4eb33ba93a3dc (diff)
vendor: update
Diffstat (limited to 'vendor/github.com/golangci/misspell/replace.go')
-rw-r--r--vendor/github.com/golangci/misspell/replace.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/vendor/github.com/golangci/misspell/replace.go b/vendor/github.com/golangci/misspell/replace.go
index bcfcf8deb..b51dfa83b 100644
--- a/vendor/github.com/golangci/misspell/replace.go
+++ b/vendor/github.com/golangci/misspell/replace.go
@@ -5,6 +5,7 @@ import (
"bytes"
"io"
"regexp"
+ "slices"
"strings"
"text/scanner"
)
@@ -17,12 +18,9 @@ func max(x, y int) int {
}
func inArray(haystack []string, needle string) bool {
- for _, word := range haystack {
- if strings.EqualFold(needle, word) {
- return true
- }
- }
- return false
+ return slices.ContainsFunc(haystack, func(word string) bool {
+ return strings.EqualFold(needle, word)
+ })
}
var wordRegexp = regexp.MustCompile(`[a-zA-Z0-9']+`)
@@ -192,7 +190,7 @@ Loop:
return buf.String(), diffs
}
-// Replace is corrects misspellings in input, returning corrected version along with a list of diffs.
+// Replace is correcting misspellings in input, returning corrected version along with a list of diffs.
func (r *Replacer) Replace(input string) (string, []Diff) {
output := r.engine.Replace(input)
if input == output {