perf: 根据golangci检测结果,优化部分代码

This commit is contained in:
mh-swift
2024-07-09 17:32:52 +08:00
parent 5c3bcaf6cc
commit 9133afb864
6 changed files with 32 additions and 27 deletions

View File

@@ -97,5 +97,5 @@ func (bf *formattedBuffer) writeToken(token string, kind formatterTokenType) {
// unifyLineFeed unifies line feeds.
func unifyLineFeed(s string) string {
return strings.Replace(strings.Replace(s, "\r\n", "\n", -1), "\r", "\n", -1)
return strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", "\n"), "\r", "\n")
}