Skip to content

Commit 9eb217f

Browse files
committed
refactor: minor changes
1 parent 57dedbb commit 9eb217f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

exptostd.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ func (a *analyzer) run(pass *analysis.Pass) (any, error) {
152152
}
153153
})
154154

155-
a.maybeReplaceImport(pass, imports, shouldKeepExpMaps, shouldKeepExpSlices)
155+
a.suggestReplaceImport(pass, imports, shouldKeepExpMaps, "golang.org/x/exp/maps")
156+
a.suggestReplaceImport(pass, imports, shouldKeepExpSlices, "golang.org/x/exp/slices")
156157

157158
return nil, nil
158159
}
@@ -204,13 +205,6 @@ func (a *analyzer) detectPackageUsage(pass *analysis.Pass,
204205
return false
205206
}
206207

207-
func (a *analyzer) maybeReplaceImport(pass *analysis.Pass, imports map[string]*ast.ImportSpec,
208-
shouldKeepExpMaps, shouldKeepExpSlices bool,
209-
) {
210-
a.suggestReplaceImport(pass, imports, shouldKeepExpMaps, "golang.org/x/exp/maps")
211-
a.suggestReplaceImport(pass, imports, shouldKeepExpSlices, "golang.org/x/exp/slices")
212-
}
213-
214208
func (a *analyzer) suggestReplaceImport(pass *analysis.Pass, imports map[string]*ast.ImportSpec, shouldKeep bool, importPath string) {
215209
imp, ok := imports[importPath]
216210
if !ok || shouldKeep {

0 commit comments

Comments
 (0)