From 3cef28b9e221c163222500861f41297ce78f726c Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 29 Dec 2024 22:24:30 +0100 Subject: [PATCH] refactor: use slices.Contains --- tagliatelle.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tagliatelle.go b/tagliatelle.go index 99c7da2..8bf8045 100644 --- a/tagliatelle.go +++ b/tagliatelle.go @@ -160,7 +160,7 @@ func report(pass *analysis.Pass, config Base, key, convName, fieldName string, n // This is an exception because of a bug. // https://github.com/ldez/tagliatelle/issues/8 // For now, tagliatelle should try to remain neutral in terms of format. - if hasTagFlag(flags, "inline") { + if slices.Contains(flags, "inline") { // skip for inline children (no name to lint) return } @@ -231,16 +231,6 @@ func lookupTagValue(tag *ast.BasicLit, key string) (name string, flags []string, return values[0], values[1:], true } -func hasTagFlag(flags []string, query string) bool { - for _, flag := range flags { - if flag == query { - return true - } - } - - return false -} - func createRadixTree(config Config, modPath string) *iradix.Tree[Base] { r := iradix.New[Base]()