refactor: using slices.Contains to simplify the code (#14781)

Signed-off-by: oftenoccur <ezc5@sina.com>
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
oftenoccur
2025-01-09 08:04:45 +08:00
committed by GitHub
parent c48d40907c
commit 393e63e8e5

View File

@@ -6,6 +6,7 @@ import (
"errors"
"go/ast"
"go/token"
"slices"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
@@ -100,10 +101,5 @@ func inspectFunctionParams(pass *analysis.Pass, paramList []*ast.Field) {
}
func shadows(name string) bool {
for _, identifier := range predeclared {
if identifier == name {
return true
}
}
return false
return slices.Contains(predeclared, name)
}