Skip to content

Commit 3324404

Browse files
committed
Replaced algorithm with stdlib equivalent
1 parent 6d63b54 commit 3324404

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

legacy/builder/ctags/ctags_has_issues.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,20 @@ import (
1919
"bufio"
2020
"os"
2121
"strings"
22+
23+
"golang.org/x/exp/slices"
2224
)
2325

2426
func (p *CTagsParser) FixCLinkageTagsDeclarations() {
2527
linesMap := p.FindCLinkageLines(p.tags)
2628
for i := range p.tags {
27-
if sliceContainsInt(linesMap[p.tags[i].Filename], p.tags[i].Line) &&
29+
if slices.Contains(linesMap[p.tags[i].Filename], p.tags[i].Line) &&
2830
!strings.Contains(p.tags[i].PrototypeModifiers, EXTERN) {
2931
p.tags[i].PrototypeModifiers = p.tags[i].PrototypeModifiers + " " + EXTERN
3032
}
3133
}
3234
}
3335

34-
func sliceContainsInt(s []int, e int) bool {
35-
for _, a := range s {
36-
if a == e {
37-
return true
38-
}
39-
}
40-
return false
41-
}
42-
4336
func (p *CTagsParser) prototypeAndCodeDontMatch(tag *CTag) bool {
4437
if tag.SkipMe {
4538
return true

0 commit comments

Comments
 (0)