diff --git a/gopls/internal/golang/change_signature.go b/gopls/internal/golang/change_signature.go
index 97cefcf..fc8c1f0 100644
--- a/gopls/internal/golang/change_signature.go
+++ b/gopls/internal/golang/change_signature.go
@@ -14,6 +14,7 @@
"go/token"
"go/types"
"regexp"
+ "slices"
goastutil "golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/gopls/internal/cache"
@@ -793,13 +794,6 @@
}
// findDecl finds the index of decl in file.Decls.
-//
-// TODO: use slices.Index when it is available.
func findDecl(file *ast.File, decl ast.Decl) int {
- for i, d := range file.Decls {
- if d == decl {
- return i
- }
- }
- return -1
+ return slices.Index(file.Decls, decl)
}