Skip to content

Commit 3fa0946

Browse files
author
Nicholas Maccharoli
committed
[stdlib] Move empty check for string concatenation to front
1 parent e5a6b22 commit 3fa0946

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/String.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,10 @@ extension String {
704704
@effects(readonly)
705705
@_semantics("string.concat")
706706
public static func + (lhs: String, rhs: String) -> String {
707-
var lhs = lhs
708707
if lhs.isEmpty {
709708
return rhs
710709
}
710+
var lhs = lhs
711711
lhs._core.append(rhs._core)
712712
return lhs
713713
}

0 commit comments

Comments
 (0)